User Defined Functions

User Defined Function Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

User Defined Function | Description
_ArrayAdd | Adds a specified value at the end of an array, returning the adjusted array.
_ArrayBinarySearch | Uses the binary search algorithm to search through a 1-dimensional array.
_ArrayCreate | Create a small array and quickly assign values.
_ArrayDelete | Deletes the specified element from the given array, returning the adjusted array.
_ArrayDisplay | Displays a 1-dimensional array in a message box.
_ArrayInsert | Inserts the a new string at the specified element into an array, returning the adjusted array.
_ArrayMax | Returns the highest value held in an array.
_ArrayMaxIndex | Returns the index where the highest value occurs in the array.
_ArrayMin | Returns the lowest value held in an array.
_ArrayMinIndex | Returns the index where the lowest value occurs in the array.
_ArrayPop | Returns the last element of an array, deleting that element from the array at the same time.
_ArrayPush | Add new values without increasing array size.Either by inserting at the end the new value and deleting the first one or vice versa.
_ArrayReverse | Takes the given array and reverses the order in which the elements appear in the array.
_ArraySearch | Finds an entry within an one-dimensional array. (Similar to _ArrayBinarySearch() except the array does not need to be sorted.)
_ArraySort | Sort a mutiple dimensional Array.
_ArraySwap | Swaps two elements of an array.
_ArrayToClip | Sends the contents of an array to the clipboard.
_ArrayToString | Places the elements of an array into a single string, separated by the specified delimiter.
_ArrayTrim | Trims all elements in an array a certain number of characters.
_ChooseColor | Creates a Color dialog box that enables the user to select a color.
_ChooseFont | Creates a Font dialog box that enables the user to choose attributes for a logical font.
_ClipPutFile | Copy Files to Clipboard Like Explorer does
_ColorGetBlue | Returns the blue component of a given color.
_ColorGetGreen | Returns the green component of a given color.
_ColorGetRed | Returns the red component of a given color.
_DateAdd | Calculates a new date based on a given date and add an interval.
_DateDayOfWeek | Returns the name of the weekday, based on the specified day.
_DateDaysInMonth | Returns the number of days in a month, based on the specified month and year.
_DateDiff | Returns the difference between 2 dates, expressed in the type requested.
_DateIsLeapYear | Checks a given year to see if it is a leap year.
_DateIsValid | Checks the given date to determine if it is a valid date.
_DateTimeFormat | Returns the date in the PC's regional settings format.
_DateTimeSplit | Split a string containing Date and Time into two separate Arrays.
_DateToDayOfWeek | Returns the weekdaynumber for a given date.
_DateToDayOfWeekISO | Returns the ISO weekdaynumber for a given date.
_DateToDayValue | Returns the daynumber since since noon 4713 BC January 1 for a given Gregorian date.
_DayValueToDate | Add the given days since noon 4713 BC January 1 and returns the Gregorian date.
_Degree | Converts radians to degrees.
_FileCountLines | Returns the number of lines in the specified file.
_FileCreate | Creates or zero's out the length of the file specified.
_FileListToArray | lists files and\or folders in a specified path (Similar to using Dir with the /B Switch)
_FilePrint | Prints a plain text file.
_FileReadToArray | Reads the specified file into an array.
_FileWriteFromArray | Writes Array records to the specified file.
_FileWriteLog | Writes current date,time and the specified text to a log file.
_FileWriteToLine | Writes text to a specific line in a file.
_GetIP | Get public IP address of a network/computer.
_GUICtrlComboAddDir | Add names to the list displayed by the combo box
_GUICtrlComboAddString | Add a string to the list box of a combo box
_GUICtrlComboAutoComplete | AutoComplete a combo box input
_GUICtrlComboDeleteString | Delete a string in the list box of a combo box
_GUICtrlComboFindString | Return the index of matching item
_GUICtrlComboGetCount | Retrieve the number of items in the list box of a combo box
_GUICtrlComboGetCurSel | Retrieve the index of the currently selected item, if any, in the list box of a combo box
_GUICtrlComboGetDroppedControlRect | Retrieve the screen coordinates of a combo box in its dropped-down state.
_GUICtrlComboGetDroppedState | Determine whether the list box of a combo box is dropped down
_GUICtrlComboGetDroppedWidth | Retrieve the minimum allowable width, of the list box of a combo box
_GUICtrlComboGetEditSel | Get the starting and ending character positions of the current selection in the edit control of a combo box.
_GUICtrlComboGetExtendedUI | Determine whether a combo box has the default user interface or the extended user interface
_GUICtrlComboGetHorizontalExtent | Retrieve from a combo box the width, in pixels
_GUICtrlComboGetItemHeight | Determine the height of list items or the selection field in a combo box
_GUICtrlComboGetLBText | Retrieve a string from the list of a combo box.
_GUICtrlComboGetLBTextLen | Retrieve the length, in characters, of a string in the list of a combo box
_GUICtrlComboGetList | Retrieves all items from the list portion of a ComboBox control.
_GUICtrlComboGetLocale | Retrieve the current locale of the combo box
_GUICtrlComboGetMinVisible | Get the minimum number of visible items in the drop-down list of a combo box
_GUICtrlComboGetTopIndex | Retrieve the zero-based index of the first visible item in the list box portion of a combo box
_GUICtrlComboInitStorage | Allocates memory for storing list box portion of the combo box items
_GUICtrlComboInsertString | Insert a string into the list box of a combo box
_GUICtrlComboLimitText | Limit the length of the text the user may type into the edit control of a combo box
_GUICtrlComboResetContent | Remove all items from the list box and edit control of a combo box
_GUICtrlComboSelectString | Search the list of a combo box for an item that begins with the characters in a specified string
_GUICtrlComboSetCurSel | Select a string in the list of a combo box
_GUICtrlComboSetDroppedWidth | Set the maximum allowable width
_GUICtrlComboSetEditSel | Select characters in the edit control of a combo box
_GUICtrlComboSetExtendedUI | Select either the default user interface or the extended user interface
_GUICtrlComboSetHorizontalExtent | Set the width, in pixels
_GUICtrlComboSetItemHeight | Set the height of list items or the selection field in a combo box
_GUICtrlComboSetMinVisible | Set the minimum number of visible items in the drop-down list of a combo box
_GUICtrlComboSetTopIndex | Ensure that a particular item is visible
_GUICtrlComboShowDropDown | Show or hide the list box of a combo box
_GUICtrlEditCanUndo | Determines whether there are any actions in an edit control's undo queue.
_GUICtrlEditEmptyUndoBuffer | Resets the undo flag of an edit control.
_GUICtrlEditFind | Find/Replace text in an Edit control
_GUICtrlEditGetFirstVisibleLine | Retrieves the zero-based index of the uppermost visible line in a multiline edit control.
_GUICtrlEditGetLineCount | Retrieves the number of lines in a multiline edit control.
_GUICtrlEditGetModify | Retrieves the state of an edit control's modification flag.
_GUICtrlEditGetRECT | Retrieves the formatting rectangle of an edit control.
_GUICtrlEditGetSel | Retrieves the starting and ending character positions of the current selection in an edit control.
_GUICtrlEditLineFromChar | Retrieves the index of the line that contains the specified character index in a multiline edit control.
_GUICtrlEditLineIndex | Retrieves the character index of the first character of a specified line in a multiline edit control.
_GUICtrlEditLineLength | Retrieves the length, in characters, of a line in an edit control.
_GUICtrlEditLineScroll | Scrolls the text in a multiline edit control.
_GUICtrlEditReplaceSel | Replaces the current selection in an edit control with the specified text.
_GUICtrlEditScroll | Scrolls the text vertically in a multiline edit control.
_GUICtrlEditSetModify | Sets or clears the modification flag for an edit control.
_GUICtrlEditSetRECT | Sets the formatting rectangle of an edit control.
_GUICtrlEditSetSel | Selects a range of characters in an edit control.
_GUICtrlEditUndo | Undoes the last edit control operation in the control's undo queue.
_GUICtrlListAddDir | Add File/Folder names to the list displayed by the list box
_GUICtrlListAddItem | Add an item to the List
_GUICtrlListClear | Remove all items from the list box
_GUICtrlListCount | Get the number of items in the list box
_GUICtrlListDeleteItem | Delete an Item from the List
_GUICtrlListFindString | Return the index of matching item
_GUICtrlListGetAnchorIndex | Get the Anchor Index
_GUICtrlListGetCaretIndex | Return index of item that has the focus rectangle
_GUICtrlListGetHorizontalExtent | Retrieve from a list box the the scrollable width (pixels)
_GUICtrlListGetInfo | Retrieve the number of items per column in a specified list box.
_GUICtrlListGetItemRect | Retrieve the dimensions of the rectangle that bounds a list box item.
_GUICtrlListGetLocale | Current Locale of the listbox
_GUICtrlListGetSelCount | Get the number of items selected
_GUICtrlListGetSelItems | Get item indices of selected items
_GUICtrlListGetSelItemsText | Get the text of selected items
_GUICtrlListGetSelState | Get the selection state of item
_GUICtrlListGetText | Returns the item (string) at the specified index
_GUICtrlListGetTextLen | Alternative to StringLen
_GUICtrlListGetTopIndex | Retrieve the index of the first visible item in a list
_GUICtrlListInsertItem | Insert a string into the list
_GUICtrlListReplaceString | Replaces the text of an item at index
_GUICtrlListSelectedIndex | Return the index of selected item
_GUICtrlListSelectIndex | Select a string and scroll it into view, if necessary
_GUICtrlListSelectString | Select item using search string
_GUICtrlListSelItemRange | Select range by index in a multiple-selection list box
_GUICtrlListSelItemRangeEx | Selects items from $i_start to $i_stop
_GUICtrlListSetAnchorIndex | Set the Anchor Index
_GUICtrlListSetCaretIndex | Set the focus rectangle to the item at the specified index.
_GUICtrlListSetHorizontalExtent | Set the width, in pixels, by which a list box can be scrolled horizontally
_GUICtrlListSetLocale | Set the locale
_GUICtrlListSetSel | Select string(s) in a multiple-selection list box
_GUICtrlListSetTopIndex | Ensure that a particular item in a list box is visible
_GUICtrlListSort | Re-sorts list box if it has the $LBS_SORT style
_GUICtrlListSwapString | Swaps the text of two items at the specified indices
_GUICtrlListViewCopyItems | Copy Items between 2 list-view controls
_GUICtrlListViewDeleteAllItems | Removes all items from a list-view control
_GUICtrlListViewDeleteColumn | Removes a column from a list-view control
_GUICtrlListViewDeleteItem | Removes an item from a list-view control
_GUICtrlListViewDeleteItemsSelected | Deletes item(s) selected
_GUICtrlListViewEnsureVisible | Ensures that a list-view item is either entirely or partially visible
_GUICtrlListViewGetBackColor | Retrieves the background color of a list-view control
_GUICtrlListViewGetCallBackMask | Retrieves the callback mask for a list-view control
_GUICtrlListViewGetCheckedState | Returns the check state for a list-view control item
_GUICtrlListViewGetColumnOrder | Retrieves the current left-to-right order of columns in a list-view control.
_GUICtrlListViewGetColumnWidth | Retrieves the width of a column in report or list view
_GUICtrlListViewGetCounterPage | Calculates the number of items that can fit vertically in the visible area of a list-view control
_GUICtrlListViewGetCurSel | Retrieve the index of current selection
_GUICtrlListViewGetExtendedListViewStyle | Retrieves the extended styles that are currently in use for a given list-view control
_GUICtrlListViewGetHeader | Retrieves the handle to the header control used by the list-view control
_GUICtrlListViewGetHotCursor | Retrieves the HCURSOR value used when the pointer is over an item while hot tracking is enabled
_GUICtrlListViewGetHotItem | Retrieves the index of the hot item
_GUICtrlListViewGetHoverTime | Retrieves the amount of time that the mouse cursor must hover over an item before it is selected
_GUICtrlListViewGetItemCount | Retrieves the number of items in a list-view control
_GUICtrlListViewGetItemText | Retrieves some or all of a list-view item
_GUICtrlListViewGetItemTextArray | Retrieves all of a list-view item
_GUICtrlListViewGetNextItem | Returns the index of the next item
_GUICtrlListViewGetSelectedCount | Determines the number of selected items in a list-view control
_GUICtrlListViewGetSelectedIndices | Retrieve indices of selected item(s) in a list-view control
_GUICtrlListViewGetSubItemsCount | Retrieve the number of columns
_GUICtrlListViewGetTopIndex | Retrieves the index of the topmost visible item when in list or report view
_GUICtrlListViewGetUnicodeFormat | Retrieves the UNICODE character format flag for the control
_GUICtrlListViewHideColumn | Hides the column "sets column width to zero"
_GUICtrlListViewInsertColumn | Inserts a column into a list-view control
_GUICtrlListViewInsertItem | Inserts a new item in a list-view control.
_GUICtrlListViewJustifyColumn | Set Justification of a column for a list-view control
_GUICtrlListViewScroll | Scrolls the content of a list-view control
_GUICtrlListViewSetCheckState | Sets the checked state of a list-view control item
_GUICtrlListViewSetColumnHeaderText | Change the text of a column header for a list-view control
_GUICtrlListViewSetColumnOrder | Sets the left-to-right order of columns in a list-view control.
_GUICtrlListViewSetColumnWidth | Changes the width of a column
_GUICtrlListViewSetHotItem | Sets the hot item for a list-view control
_GUICtrlListViewSetHoverTime | Sets the amount of time which the mouse cursor must hover over an item before it is selected
_GUICtrlListViewSetItemCount | Causes the list-view control to allocate memory for the specified number of items.
_GUICtrlListViewSetItemSelState | Sets the Item Selected/UnSelected
_GUICtrlListViewSetItemText | Changes the text of a list-view item or subitem.
_GUICtrlListViewSort | Sorts a list-view control.
_GUICtrlMonthCalGet1stDOW | Retrieves the first day of the week for a month calendar control.
_GUICtrlMonthCalGetColor | Retrieves the color for a given portion of a month calendar control.
_GUICtrlMonthCalGetDelta | Retrieves the scroll rate for a month calendar control.
_GUICtrlMonthCalGetMaxSelCount | Retrieves the maximum date range that can be selected in a month calendar control.
_GUICtrlMonthCalGetMaxTodayWidth | Retrieves the maximum width of the "today" string in a month calendar control.
_GUICtrlMonthCalGetMinReqRECT | Retrieves the minimum size required to display a full month in a month calendar control.
_GUICtrlMonthCalSet1stDOW | Sets the first day of the week for a month calendar control.
_GUICtrlMonthCalSetColor | Sets the color for a given portion of a month calendar control.
_GUICtrlMonthCalSetDelta | Sets the scroll rate for a month calendar control.
_GUICtrlMonthCalSetMaxSelCount | Sets the maximum number of days that can be selected in a month calendar control.
_GUICtrlSliderClearTics | Removes the current tick marks from a slider.
_GUICtrlSliderGetLineSize | Retrieves the number of logical positions the slider moves.
_GUICtrlSliderGetNumTics | Retrieves the number of tick marks from a slider.
_GUICtrlSliderGetPageSize | Retrieves the number of logical positions the slider moves.
_GUICtrlSliderGetPos | Retrieves the logical position the slider.
_GUICtrlSliderGetRangeMax | Retrieves the maximum position for the slider.
_GUICtrlSliderGetRangeMin | Retrieves the minimum position for the slider.
_GUICtrlSliderSetLineSize | Sets the number of logical positions the slider moves.
_GUICtrlSliderSetPageSize | Sets the number of logical positions the slider moves.
_GUICtrlSliderSetPos | Sets the current logical position of the slider.
_GUICtrlSliderSetTicFreq | Sets the interval frequency for tick marks in a slider.
_GUICtrlStatusBarCreate | Creates Statusbar
_GUICtrlStatusBarGetBorders | Gets width of the borders.
_GUICtrlStatusBarGetIcon | Gets Statusbar panel Icon handle.
_GUICtrlStatusBarGetParts | Retrieves a count of the parts in a status window.
_GUICtrlStatusBarGetRect | Retrieves the bounding rectangle of a part in a status window.
_GUICtrlStatusBarGetText | Gets Statusbar Text from a part.
_GUICtrlStatusBarGetTextLength | Retrieves the length, in characters, of the text from the specified part of a status window.
_GUICtrlStatusBarGetTip | Gets Statusbar TipText.
_GUICtrlStatusBarGetUnicode | Retrieves the Unicode character format flag for the control.
_GUICtrlStatusBarResize | Resize Statusbar.
_GUICtrlStatusBarSetBKColor | Sets the background color in a status bar.
_GUICtrlStatusBarSetIcon | Sets an Icon in the Panel.
_GUICtrlStatusBarSetMinHeight | Sets the minimum height of a status window's drawing area.
_GUICtrlStatusBarSetSimple | Specifies whether a status window displays simple text or displays all window parts.
_GUICtrlStatusBarSetText | Sets the text in the specified part of a status window.
_GUICtrlStatusBarSetTip | Sets the ToolTip text for a part in a status bar.
_GUICtrlStatusBarSetUnicode | Sets the Unicode character format flag for the control.
_GUICtrlTabDeleteAllItems | Removes all items from a tab control.
_GUICtrlTabDeleteItem | Removes an item from a tab control.
_GUICtrlTabDeselectAll | Resets items in a tab control.
_GUICtrlTabGetCurFocus | Returns the index of the item that has the focus in a tab control.
_GUICtrlTabGetCurSel | Determines the currently selected tab in a tab control.
_GUICtrlTabGetExtendedStyle | Retrieves the extended styles that are currently in use for the tab control.
_GUICtrlTabGetItemCount | Retrieves the number of tabs in the tab control.
_GUICtrlTabGetItemRECT | Retrieves the bounding rectangle for a tab in a tab control.
_GUICtrlTabGetRowCount | Retrieves the current number of rows of tabs in a tab control.
_GUICtrlTabGetUnicodeFormat | Retrieves the Unicode character format flag for the control.
_GUICtrlTabHighlightItem | Sets the highlight state of a tab item.
_GUICtrlTabSetCurFocus | Sets the focus to a specified tab in a tab control.
_GUICtrlTabSetCurSel | Selects a tab in a tab control.
_GUICtrlTabSetMinTabWidth | Sets the minimum width of items in a tab control.
_GUICtrlTabSetUnicodeFormat | Sets the Unicode character format flag for the control.
_GUICtrlTreeViewDeleteAllItems | Removes all items from a treeview control.
_GUICtrlTreeViewDeleteItem | Removes an item and all its children from a treeview control.
_GUICtrlTreeViewExpand | Expands or collapses the list of child items associated with the specified parent item, if any.
_GUICtrlTreeViewGetBkColor | Gets the text back color of a treeview control.
_GUICtrlTreeViewGetCount | Retrieves a count of the items in a treeview control.
_GUICtrlTreeViewGetIndent | Retrieves the amount in pixels, that child items are indented relative to their parent items.
_GUICtrlTreeViewGetLineColor | Gets the line color of a treeview control.
_GUICtrlTreeViewGetParentHandle | Gets the parent handle of item selected (default) or any specified item in treeview control.
_GUICtrlTreeViewGetParentID | Gets the parent control ID of item selected (default) or any specified item in treeview control.
_GUICtrlTreeViewGetState | Returns the state of the specified treeview item.
_GUICtrlTreeViewGetText | Returns the test of the specified treeview item.
_GUICtrlTreeViewGetTextColor | Gets the text color of a treeview control.
_GUICtrlTreeViewGetTree | Get all items text beginning by the current selected item from the treeview control.
_GUICtrlTreeViewInsertItem | Insert a new item into a treeview control.
_GUICtrlTreeViewSetBkColor | Sets the back color of a treeview control.
_GUICtrlTreeViewSetIcon | Set an icon of the specified treeview item.
_GUICtrlTreeViewSetIndent | Sets the width of indentation for a treeview control and redraws the control to reflect the new width.
_GUICtrlTreeViewSetLineColor | Sets the line color of a treeview control
_GUICtrlTreeViewSetState | Set the state of the specified treeview item.
_GUICtrlTreeViewSetText | Set a new text to the specified treeview item.
_GUICtrlTreeViewSetTextColor | Sets the text color of a treeview control.
_GUICtrlTreeViewSort | Sorts the items of a treeview control.
_HexToString | Convert a hex string to a string.
_IE_Example | Display a new browser window pre-loaded with documents to be used in IE.au3 examples
_IE_Introduction | Display introductory information about IE.au3 in a new browser window
_IE_VersionInfo | Returns an array of information about the IE.au3 version
_IEAction | Perform any of a set of simply actions on the Browser.
_IEAttach | Attach to the first existing instance of Internet Explorer where the search string sub-string matches based on the selected mode.
_IEBodyReadHTML | Returns the HTML inside the tag of the document.
_IEBodyReadText | Returns the Text inside the tag of the document.
_IEBodyWriteHTML | Replaces the HTML inside the tag of the document.
_IECreate | Create an Internet Explorer Browser Window.
_IECreateEmbedded | Create a Webbrowser object suitable for embedding in an AutoIt GUI with GuiCtrlCreateObj().
_IEDocGetObj | Given any DOM object, returns a reference to the associated document object.
_IEDocReadHTML | Returns the full HTML source of a document.
_IEDocWriteHTML | Replaces the HTML for the entire document.
_IEErrorHandlerDeRegister | Disable a registered user COM error handler
_IEErrorHandlerRegister | Register and enable a user COM error handler
_IEErrorNotify | Specifies whether IE.au3 automatically notifies of Warnings and Errors (to the console)
_IEFormElementCheckBoxSelect | Set the value of a specified form element.
_IEFormElementGetCollection | Returns a collection object variable representing all Form Elements within a given Form.
_IEFormElementGetObjByName | Returns an object reference to a Form Element by name.
_IEFormElementGetValue | Returns the value of a given Form Element.
_IEFormElementOptionSelect | Set the value of a specified form element.
_IEFormElementRadioSelect | Set the value of a specified form element.
_IEFormElementSetValue | Set the value of a specified Form Element.
_IEFormGetCollection | Returns a collection object variable representing the Forms in the document.
_IEFormGetObjByName | Returns an object reference to a Form by name.
_IEFormImageClick | Simulate a mouse click on an <input type=image>. Match by sub-string match of alt text, name or src.
_IEFormReset | Reset a specified Form.
_IEFormSubmit | Submit a specified Form.
_IEFrameGetCollection | Returns a collection object containing the frames in a FrameSet or the iFrames on a normal page.
_IEFrameGetObjByName | Returns an object reference to a Frame by name.
_IEGetObjByName | Returns an object variable by name or id.
_IEHeadInsertEventScript | Inserts a Javascript into the Head of the document.
_IEImgClick | Simulate a mouse click on an image. Match by sub-string match of alt text, name, or src.
_IEImgGetCollection | Returns a collection object variable representing the IMG tags in the document.
_IEIsFrameSet | Checks to see if the specified Window contains a FrameSet.
_IELinkClickByIndex | Simulate a mouse click on a link by 0-based index (in source order).
_IELinkClickByText | Simulate a mouse click on a link with text sub-string matching the string provided.
_IELinkGetCollection | Returns a collection object containing all links in the document.
_IELoadWait | Wait for a browser page load to complete before returning.
_IELoadWaitTimeout | Retrieve or set the current value in milliseconds _IELoadWait will try before timing out.
_IENavigate | Directs an existing browser window to navigate to the specified URL.
_IEPropertyGet | Returns a select property of the Browser.
_IEPropertySet | Set a select property of the Browser.
_IEQuit | Close the browser and remove the object reference to it.
_IETableGetCollection | Returns a collection object variable representing all the tables in a document.
_IETableWriteToArray | Reads the contents of a Table into an array.
_IETagNameAllGetCollection | Returns a collection object all elements in the document or document hierarchy in source order.
_IETagNameGetCollection | Returns a collection object of all elements in the object with the specified TagName.
_Iif | Perform a boolean test within an expression.
_INetExplorerCapable | Converts a string to IE(Internet Explorer) capable line
_INetGetSource | Gets the source from an URL without writing a temp file.
_INetMail | Opens default user's mail client with given address, subject, and body.
_INetSmtpMail | Sends an email without using an external email program.
_IsPressed | Check if key has been pressed
_MathCheckDiv | Checks if NumA is divisable by NumB
_Max | Evaluates which of the two numbers is higher.
_Min | Evaluates which of the two numbers is lower.
_MouseTrap | Confine the Mouse Cursor to specified coords.
_Now | Returns the current Date and Time in PC's format.
_NowCalc | Returns the current Date and Time in format YYYY/MM/DD HH:MM:SS for use in date calculations.
_NowCalcDate | Returns the current Date in format YYYY/MM/DD.
_NowDate | Returns the current Date in the Pc's format.
_NowTime | Returns the current Time in requested format.
_PathFull | Creates a path based on the relative path you provide. The newly created absolute path is returned
_PathMake | Creates a path from drive, directory, file name and file extension parts. Not all parts must be passed.
_PathSplit | Splits a path into the drive, directory, file name and file extension parts. An empty string is set if a part is missing.
_ProcessGetName | Returns a string containing the process name that belongs to a given PID.
_ProcessGetPriority | Get the priority of an open process
_Radian | Converts degrees to radians.
_ReplaceStringInFile | Replaces a string with another string in the given text file (binary won't work!)
_RunDOS | Executes a DOS command in a hidden command window.
_SetDate | Sets the current date of the system
_SetTime | Sets the current time of the system
_Singleton | Check if no other occurrence is running.
_StringEncrypt | An RC4 based string encryption function.
_StringInsert | Inserts a string within another string.
_StringProper | Changes a string to proper case, same a =Proper function in Excel
_StringRepeat | Repeats a string a specified number of times.
_StringReverse | Reverses the contents of the specified string.
_StringToHex | Convert a string to a hex string.
_TempFile | Generate a name for a temporary file. The file is guaranteed not to exist yet.
_TicksToTime | Converts the specified tick amount to hours, minutes, and seconds.
_TimeToTicks | Converts the specified hours, minutes, and seconds to ticks.
_viClose | Closes a VISA connection to an Instrument/Device
_viExecCommand | Send a Command/Query to an Instrument/Device through the VISA interface (GPIB / TCP)
_viFindGpib | Send a Command/Query to an Instrument/Device through the VISA interface (GPIB / TCP)
_viGpibBusReset | GPIB BUS "reset": Use this function when the GPIB BUS gets stuck for some reason. You might be lucky and resolve the problem by calling this function
_viGTL | Go To Local mode: Instruments that accept this command will exit the "Remote Control mode" and go to "Local mode". If the instrument is already in "Local mode" this is simply ignored. Normally, if an instrument does not support this command it will simply stay in the "Remote Control mode"
_viOpen | Opens a VISA connection to an Instrument/Device
_viSetAttribute | Set any VISA attribute This function, which is called by _viSetTimeout, can ALSO be used to set the other VISA specific attributes. Read the VISA documentation for more information and a list of VISA attributes and their corresponding values.
_viSetTimeout | Sets the VISA timeout in MILISECONDS
_WeekNumberISO | Calculate the weeknumber of a given date.


Function Notes

User Defined Function Notes

We have included number of files that each contain standard AutoIt3 Functions, so called User Defined Functions.
UDF's are functions/Scriptlets, written in AutoIt3, you can #include in your own script and use them without the need to program it yourself or Copy&Paste them every time you need them.

Example:

#include <date.au3>

MsgBox(0,"Today","Today's date is " & Now())

This script will display today's date formatted in your pc's long format. e.g. "Sunday, December 18, 2004"

Many UDF's contain optional parameters that can be omitted. If you wish to specify an optional parameter, however, all parameters that precede it must be specified!
For example, consider _ArraySort ( ByRef $a_Array, [[[[$i_Descending], $i_Base=0], $i_Ubound=0, $i_Dim=1]] )
When a parameters is preceded with Byref mean that the function will update this variable with a new value. These parameters must be a variable ($xyz) and cannot be a constant.

Most UDF's indicate success/failure as a return value; others indicate it by setting the @error flag. Some do both....
@error = 0 ;is always success
Return = varies, but is typically non-zero for success to allow easy to read code...

If a function can set the @error flag, you should always check it before using a return value - if @error indicates an error then the function return value is generally undefined...


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: Array Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_ArrayAdd | Adds a specified value at the end of an array, returning the adjusted array.
_ArrayBinarySearch | Uses the binary search algorithm to search through a 1-dimensional array.
_ArrayCreate | Create a small array and quickly assign values.
_ArrayDelete | Deletes the specified element from the given array, returning the adjusted array.
_ArrayDisplay | Displays a 1-dimensional array in a message box.
_ArrayInsert | Inserts the a new string at the specified element into an array, returning the adjusted array.
_ArrayMax | Returns the highest value held in an array.
_ArrayMaxIndex | Returns the index where the highest value occurs in the array.
_ArrayMin | Returns the lowest value held in an array.
_ArrayMinIndex | Returns the index where the lowest value occurs in the array.
_ArrayPop | Returns the last element of an array, deleting that element from the array at the same time.
_ArrayPush | Add new values without increasing array size.Either by inserting at the end the new value and deleting the first one or vice versa.
_ArrayReverse | Takes the given array and reverses the order in which the elements appear in the array.
_ArraySearch | Finds an entry within an one-dimensional array. (Similar to _ArrayBinarySearch() except the array does not need to be sorted.)
_ArraySort | Sort a mutiple dimensional Array.
_ArraySwap | Swaps two elements of an array.
_ArrayToClip | Sends the contents of an array to the clipboard.
_ArrayToString | Places the elements of an array into a single string, separated by the specified delimiter.
_ArrayTrim | Trims all elements in an array a certain number of characters.


Function _ArrayAdd

Function Reference

_ArrayAdd

Adds a specified value at the end of an array, returning the adjusted array.

#include <Array.au3>
_ArrayAdd ( $avArray, $sValue )

Parameters

$avArray | The array to which the element is to be added.
$sValue | The value to be added.

Return Value

Success: | Returns 1 and the modified array.
Failure: | Returns a 1-element array with the value added to it.
@Error: | 0 = No error.
 | 1 = $avArray isn't an array.

Remarks

This function will return an array even if both parameters are empty strings (""). In this case it will return an array with 1-element that contains an empty string value.

Related

_ArrayDelete, _ArrayInsert

Example

#include <Array.au3>
Dim $avArray[10]
$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"
_ArrayDisplay( $avArray, "Whole array" )
_ArrayAdd( $avArray,"Brian")
_ArrayDisplay( $avArray, "Updated Array" )


Function _ArrayBinarySearch

Function Reference

_ArrayBinarySearch

Uses the binary search algorithm to search through a 1-dimensional array.

#include <Array.au3>
_ArrayBinarySearch ( $avArray, $iKey [, $i_Base=0] )

Parameters

$avArray | The 1-dimensional sorted array to search on.
$iKey | String or number to search for in the array.
$i_Base | Optional: Start Array index for sort, normally set to 0 or 1.

Return Value

Success: | Returns the key (index of where item is in the array).
Failure: | Returns an empty string.
@Error: | 0 = No error.
 | 1 = $avArray isn't an array.
 | 2 = $iKey is out of bounds.
 | 3 = If the item wasn't found in the array.

Remarks

When doing a binary search on an array of items, the contents MUST be sorted before the search is done. Otherwise undefined results will be returned.

The array is passed to the function by reference and so doesn't use up any additional resources other than a few internal variables.

Related

None.

Example

#include <Array.au3>
Dim $avArray[10]

$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"

; sort the array to be able to do a binary search
_ArraySort( $avArray)

; display sorted array
_ArrayDisplay( $avArray, "sorted" )

; Lookup existing entry
$iKeyIndex = _ArrayBinarySearch ( $avArray, "Jon" )
If Not @error Then
Msgbox(0,'Entry found',' Index:' & $iKeyIndex)
Else
Msgbox(0,'Entry Not found',' Error:' & @error)
EndIf

; Lookup None existing entry
$iKeyIndex = _ArrayBinarySearch ( $avArray, "Unknown" )
If Not @error Then
Msgbox(0,'Entry found',' Index:' & $iKeyIndex)
Else
Msgbox(0,'Entry Not found',' Error:' & @error)
EndIf

;
; Example 2, using an Array returned by StringSplit
;
$avArray = StringSplit("a,b,d,c,e,f,g,h,i",",")

; sort the array to be able to do a binary search
_ArraySort( $avArray, 0, 1)

; display sorted array
_ArrayDisplay( $avArray, "sorted" )

; added 1 as second parameter to skip looking in $avArray[0]
$iKeyIndex = _ArrayBinarySearch ( $avArray, "c",1 )
If Not @error Then
Msgbox(0,'Entry found',' Index:' & $iKeyIndex)
Else
Msgbox(0,'Entry Not found',' Error:' & @error)
EndIf

Exit


Function _ArrayCreate

Function Reference

_ArrayCreate

Create a small array and quickly assign values.

#include <Array.au3>
_ArrayCreate ( $v_Val1, [$v_Val2, [..., $v_Val21]] )

Parameters

$v_Val1 | The first element of the array.
$v_Val2 | Optional: The second element of the array.
. | 0
. | 0
. | 0
$v_Val21 | Optional: The twentyfirst element of the array.

Return Value

The array with values.

Remarks

Arrays up to 21 elements are supported.

Related

None.

Example

#include <Array.au3>

Dim $avArray
$avArray = _ArrayCreate("JPM", "Holger", "Jon", "Larry", "Jeremy", "Valik", "Cyberslug", "Nutster", "Tylo", "JdeB")

_ArrayDisplay( $avArray, "Array created with _ArrayCreate" )

Exit


Function _ArrayDelete

Function Reference

_ArrayDelete

Deletes the specified element from the given array, returning the adjusted array.

#include <Array.au3>
_ArrayDelete ( $avArray, $iElement )

Parameters

$avArray | The array from which an element is to be deleted.
$iElement | The index of the element to be deleted.

Return Value

Success: | Returns 1 and the modified array is stored in the original Array.
Failure: | Returns 0 and the original Array.
@Error: | 0 = No error.
 | 1 = $avArray isn't an array.
 | 2 = $avArray has only 1 element in it.

Remarks

If the array passed in has only 1 element, this function returns an empty string.
If the modified array equals the original array, then the original array is returned and @error is set to 2.

Related

_ArrayAdd, _ArrayInsert

Example

#include <Array.au3>

Dim $avArray[10]
$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"
_ArrayDisplay( $avArray, "Whole array" )
_ArrayDelete( $avArray,8)
_ArrayDisplay( $avArray, "Removed entry 8" )


Function _ArrayDisplay

Function Reference

_ArrayDisplay

Displays a 1-dimensional array in a message box.

#include <Array.au3>
_ArrayDisplay ( $avArray, $sTitle )

Parameters

$avArray | The array to display.
$sTitle | The title of the message box.

Return Value

Success: | Returns 1.
Failure: | Returns 0.
@Error: | 0 = No error.
 | 1 = $avArray isn't an array.

Remarks

None.

Related

_ArrayToClip

Example

; Ex. #1:

#include <Array.au3>

$asControls = StringSplit( WinGetClassList( "", "" ), @LF )
_ArrayDisplay( $asControls, "Class List of Active Window" )
Exit

; Ex. #2:

#include <Array.au3>

Dim $avArray[8]
$avArray[0] = 7
$avArray[1] = "Brian"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Christa"
$avArray[5] = "Rick"
$avArray[6] = "Jack"
$avArray[7] = "Gregory"

_ArrayDisplay( $avArray, "_ArrayDisplay() Test" )
Exit


Function _ArrayInsert

Function Reference

_ArrayInsert

Inserts the a new string at the specified element into an array, returning the adjusted array.

#include <Array.au3>
_ArrayInsert ( $avArray, $iElement[, $sValue] )

Parameters

$avArray | The array from which an element is to be inserted.
$iElement | The index where the element is to be inserted.
$sValue | Optional: String to insert at the specified position.

Return Value

Success: | Returns 1 and updates the original array.
Failure: | Returns 0.
@Error: | 0 = No error.
 | 1 = $avArray isn't an array.

Remarks

None.

Related

_ArrayAdd, _ArrayDelete

Example

#include <Array.au3>

Dim $avArray[10]
$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"
_ArrayDisplay( $avArray, "Whole array" )
_ArrayInsert( $avArray,4,"New")
_ArrayDisplay( $avArray, "Updated Array" )
Exit


Function _ArrayMax

Function Reference

_ArrayMax

Returns the highest value held in an array.

#include <Array.au3>
_ArrayMax ( $avArray[[, $iCompNumeric], $i_Base] )

Parameters

$avArray | The array to be scanned.
$iCompNumeric | 0 = Alpha numeric compare 1 = Numeric compare
$i_Base | Optional: Start Array index for sort, normally 0 or 1. default = 0

Return Value

Success: | Returns the highest value in the array.
Failure: | Returns an empty string.
@Error: | 0 = No error.
 | 1 = $avArray isn't an array.

Remarks

None.

Related

_ArrayMaxIndex, _ArrayMin, _ArrayMinIndex

Example

#include <Array.au3>
;
$avArray = StringSplit("4,2,06,8,12,5",",")
;
MsgBox(0,'Max Index String value',_ArrayMaxIndex( $avArray, 0, 1))
MsgBox(0,'Max Index Numeric value',_ArrayMaxIndex( $avArray, 1, 1))
;
MsgBox(0,'Max String value',_ArrayMax( $avArray, 0, 1))
MsgBox(0,'Max Numeric value',_ArrayMax( $avArray, 1, 1))
;
MsgBox(0,'Min Index String value',_ArrayMinIndex( $avArray , 0, 1))
MsgBox(0,'Min Index Numeric value',_ArrayMinIndex( $avArray, 1, 1))
;
MsgBox(0,'Min String value',_ArrayMin( $avArray, 0, 1))
MsgBox(0,'Min Numeric value',_ArrayMin( $avArray, 1, 0))

Exit


Function _ArrayMaxIndex

Function Reference

_ArrayMaxIndex

Returns the index where the highest value occurs in the array.

#include <Array.au3>
_ArrayMaxIndex ( $avArray[[, $iCompNumeric], $i_Base] )

Parameters

$avArray | The array to be scanned.
$iCompNumeric | 0 = Alpha numeric compare 1 = Numeric compare
$i_Base | Optional: Start Array index , normally 0 or 1. default = 0

Return Value

Success: | Returns the index of the highest value in the array.
Failure: | Returns an empty string.
@Error: | 0 = No error.
 | 1 = $avArray isn't an array.

Remarks

None.

Related

_ArrayMax, _ArrayMin, _ArrayMinIndex

Example

#include <Array.au3>
;
$avArray = StringSplit("4,2,06,8,12,5",",")
;
MsgBox(0,'Max Index String value',_ArrayMaxIndex( $avArray, 0, 1))
MsgBox(0,'Max Index Numeric value',_ArrayMaxIndex( $avArray, 1, 1))
;
MsgBox(0,'Max String value',_ArrayMax( $avArray, 0, 1))
MsgBox(0,'Max Numeric value',_ArrayMax( $avArray, 1, 1))
;
MsgBox(0,'Min Index String value',_ArrayMinIndex( $avArray , 0, 1))
MsgBox(0,'Min Index Numeric value',_ArrayMinIndex( $avArray, 1, 1))
;
MsgBox(0,'Min String value',_ArrayMin( $avArray, 0, 1))
MsgBox(0,'Min Numeric value',_ArrayMin( $avArray, 1, 0))

Exit


Function _ArrayMin

Function Reference

_ArrayMin

Returns the lowest value held in an array.

#include <Array.au3>
_ArrayMin ( $avArray[[, $iCompNumeric], $i_Base] )

Parameters

$avArray | The array to be scanned.
$iCompNumeric | 0 = Alpha numeric compare 1 = Numeric compare
$i_Base | Optional: Start Array index for sort, normally 0 or 1. default = 0

Return Value

Success: | Returns the lowest value in the array.
Failure: | Returns an empty string.
@Error: | 0 = No error.
 | 1 = $avArray isn't an array.

Remarks

None.

Related

_ArrayMax, _ArrayMaxIndex, _ArrayMinIndex

Example

#include <Array.au3>
;
$avArray = StringSplit("4,2,06,8,12,5",",")
;
MsgBox(0,'Max Index String value',_ArrayMaxIndex( $avArray, 0, 1))
MsgBox(0,'Max Index Numeric value',_ArrayMaxIndex( $avArray, 1, 1))
;
MsgBox(0,'Max String value',_ArrayMax( $avArray, 0, 1))
MsgBox(0,'Max Numeric value',_ArrayMax( $avArray, 1, 1))
;
MsgBox(0,'Min Index String value',_ArrayMinIndex( $avArray , 0, 1))
MsgBox(0,'Min Index Numeric value',_ArrayMinIndex( $avArray, 1, 1))
;
MsgBox(0,'Min String value',_ArrayMin( $avArray, 0, 1))
MsgBox(0,'Min Numeric value',_ArrayMin( $avArray, 1, 0))

Exit


Function _ArrayMinIndex

Function Reference

_ArrayMinIndex

Returns the index where the lowest value occurs in the array.

#include <Array.au3>
_ArrayMinIndex ( $avArray[[, $iCompNumeric], $i_Base] )

Parameters

$avArray | The array to be scanned.
$iCompNumeric | 0 = Alpha numeric compare 1 = Numeric compare
$i_Base | Optional: Start Array index, normally 0 or 1. default = 0

Return Value

Success: | Returns the index of the lowest value in the array.
Failure: | Returns an empty string.
@Error: | 0 = No error.
 | 1 = $avArray isn't an array.

Remarks

None.

Related

_ArrayMax, _ArrayMaxIndex, _ArrayMin

Example

#include <Array.au3>
;
$avArray = StringSplit("4,2,06,8,12,5",",")
;
MsgBox(0,'Max Index String value',_ArrayMaxIndex( $avArray, 0, 1))
MsgBox(0,'Max Index Numeric value',_ArrayMaxIndex( $avArray, 1, 1))
;
MsgBox(0,'Max String value',_ArrayMax( $avArray, 0, 1))
MsgBox(0,'Max Numeric value',_ArrayMax( $avArray, 1, 1))
;
MsgBox(0,'Min Index String value',_ArrayMinIndex( $avArray , 0, 1))
MsgBox(0,'Min Index Numeric value',_ArrayMinIndex( $avArray, 1, 1))
;
MsgBox(0,'Min String value',_ArrayMin( $avArray, 0, 1))
MsgBox(0,'Min Numeric value',_ArrayMin( $avArray, 1, 0))

Exit


Function _ArrayPop

Function Reference

_ArrayPop

Returns the last element of an array, deleting that element from the array at the same time.

#include <Array.au3>
_ArrayPop ( $avArray )

Parameters

$avArray The array to be decreased.

Return Value

Success: | Returns the value of the last element.
Failure: | Returns an empty string.
@Error: | 0 = No error.
 | 1 = $avArray isn't an array.

Remarks

This function changes the array in place by useing the ByRef keyword in the parameter definition of $avArray. So, not only does it return the last element of the array, but it ALSO changes the array to have 1 less element.

Related

None.

Example

#include <Array.au3>

Dim $avArray[10]
$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"

While UBound($avArray) > 0
MsgBox(0,'',_ArrayPop($avArray))
_ArrayDisplay( $avArray, "Entries left in the array" )
WEnd

Exit


Function _ArrayPush

Function Reference

_ArrayPush

Add new values without increasing array size.Either by inserting at the end the new value and deleting the first one or vice versa.

#include <Array.au3>
_ArrayPush ( ByRef $avArray, $sValue [, $i_Direction = 0] )

Parameters

$avArray | Input Array to updated.
$sValue | New value to be added.It can be an array too.
$i_Direction | Optional: 0 = Leftwise slide of values (default) 1 = Rightwise slide of values

Return Value

On Success - Returns 1
On Failure - 0 if $avArray is not an array.
-1 if $sValue array size is greater than $avArray size.
In both cases @error is set to 1.

Remarks

This function is used for continuous updates of data in array, where in other cases a vast size of array would be created.It keeps all values inside the array -something like History - ,minus the first one or the last one depending on direction chosen.It is similar to Push command in Assembly.

Related

_ArrayPop

Example

#include <Array.au3>

;First Example

Dim $test[5],$var[2],$b=5
$test[0]=0
$test[1]=1
$test[2]=2
$test[3]=3
$test[4]=4

$var[0]=6
$var[1]=7

_ArrayPush($test,$b)
_ArrayDisplay($test,"ArrayUpdate Test") ; The values now are : 1,2,3,4,5

_ArrayPush($test,$var)
_ArrayDisplay($test,"ArrayUpdate Test") ; The values now are : 3,4,5,6,7

;Second Example(not working)
Dim $Monitor[5],$Messages=""
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
;;;;
EndSelect
_ArrayPush($Monitor,$msg)
WEnd

For $i = 0 to 4
$Messages&=$monitor[$i] & ","
Next

MsgBox(0,"Monitoring Test"," The last 5 GUI Messages were : " & $Messages)


Function _ArrayReverse

Function Reference

_ArrayReverse

Takes the given array and reverses the order in which the elements appear in the array.

#Include <Array.au3>
_ArrayReverse(ByRef $avArray[, $i_Base = 0[, $i_UBound = 0]])

Parameters

$avArray | The array to be reversed.
$i_Base | Optional: Array base
$i_UBound | Optional: Upper bound of Array

Return Value

Success: | Returns 1
Failure: | Returns 0 if non array passed for array param.

Remarks

None

Related

_ArraySwap

Example

#include <Array.au3>
Dim $avArray[10]
$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "Tylo"
$avArray[9] = "JdeB"

_ArrayDisplay( $avArray, "Normal" )
_ArrayReverse( $avArray)
_ArrayDisplay( $avArray, "Reversed" )

; Example Reverse Array created with StringSplit.
$avArray = StringSplit("0,1,2,3,4,5,6,7,8,9,10,11,12",",")
_ArrayDisplay( $avArray, "Normal" )
_ArrayReverse( $avArray, 1) ; added the 1 as second parameter
_ArrayDisplay( $avArray, "Reversed" )

Exit


Function _ArraySearch

Function Reference

_ArraySearch

Finds an entry within an one-dimensional array. (Similar to _ArrayBinarySearch() except the array does not need to be sorted.)

#include <Array.au3>
_ArraySearch($avArray, $vWhat2Find, $iStart = 0, $iEnd = 0, $iCaseSense = 0)

Parameters

$avArray | The array to search
$vWhat2Find | What to search $avArray for
$iStart | (Optional) Start array index for search, normally set to 0 or 1. If omitted it is set to 0
$iEnd | (Optional) End array index for search. If omitted or set to 0 it is set to Ubound($AvArray)-
$iCaseSense | (Optional) If set to 1 then search is case sensitive

Return Value

Success:The first found instance of $vWhat2Find in $avArray
Failure:Returns -1 and sets @Error on Errors.
@Error=1 $avArray is not an array
@Error=2 $iStart is greater than UBound($AvArray)-1
@Error=3 $iEnd is greater than UBound($AvArray)-1
@Error=4 $iStart is greater than $iEnd
@Error=5 $iCaseSense was invalid. (Must be 0 or 1)
@Error=6 $vWhat2Find was not found in $avArray

Remarks

This function might be slower than _ArrayBinarySearch() but is useful when the array's order can't be altered.

Related

_ArrayBinarySearch

Example

#Include<Array.au3>
Dim $Array[6]
$Array[0] = "String0"
$Array[1] = "String1"
$Array[2] = "String2"
$Array[3] = "String3"
$Array[4] = "String4"
$Array[5] = "String5"

$Input = InputBox("ArraySearch Demo", "String To Find?")
If @error Then Exit

$Pos = _ArraySearch ($Array, $Input)
Select
Case $Pos = -1
MsgBox(0, "Not Found", '"' & $Input & '" was not found in the array.')
Case Else
MsgBox(0, "Found", '"' & $Input & '" was found in the array at pos ' & $Pos & ".")
EndSelect


Function _ArraySort

Function Reference

_ArraySort

Sort a mutiple dimensional Array.

#include <Array.au3>
_ArraySort ( ByRef $a_Array, [$i_Descending[, $i_Base=0[, $i_Ubound=0[, $i_Dim=1[, $i_SortIndex=0]]]]] )

Parameters

$a_Array | Input Array to be sorted.
$i_Descending | Optional: 1=Sort Descending else Ascending.
$i_Base | Optional: Start Array index for sort, normally set to 0 or 1.
$i_Ubound | Optional: Set the UBound for sorting which will only sort the defined number of entries in stead of the whole array.
$i_Dim | Optional: Number of occurences in the second dimension eg $A[100] = 0, $A[100][2] = 2, $A[100][5] = 5
$i_SortIndex | Optional: The index to Sort on.

Return Value

None.

Remarks

This sort functions can handle 1 or 2 dimension arrays.

Related

None.

Example

#include <Array.au3>

Dim $avArray[10]
$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "Tylo"
$avArray[9] = "JdeB"

_ArrayDisplay( $avArray, "Unsorted" )
_ArraySort( $avArray)
_ArrayDisplay( $avArray, "Sort Ascending" )
_ArraySort( $avArray,1)
_ArrayDisplay( $avArray, "Sort Decending" )

; Example sort Array created with StringSplit.
$avArray = StringSplit("b,d,c,w,a,e,s,r,x,q",",")
_ArrayDisplay( $avArray, "UnSorted" )
_ArraySort( $avArray,0,1,5) ; sort first 5 entries
_ArrayDisplay( $avArray, "Sort first 5 entries" )
_ArraySort( $avArray,0,1) ; sort and start at 1.. skip array[0]
_ArrayDisplay( $avArray, "Sorted starting at 1" )
_ArraySort( $avArray,1,1) ; sort and start at 1.. skip array[0]
_ArrayDisplay( $avArray, "Sorted Desc starting at 1" )

; Demonstration difference Alpha-numeric and Numeric sorting
Dim $avArray = StringSplit("2|4|7|1|-9|5","|")
_ArrayDisplay( $avArray, "Unsorted" )
_ArraySort( $avArray,1,1)
_ArrayDisplay( $avArray, "Alpha numeric Sorted Descending" )
;Convert Array entries to numeric values
For $x = 1 To UBound($avArray) -1
$avArray[$x] = Number($avArray[$x])
Next
_ArraySort( $avArray,1,1)
_ArrayDisplay( $avArray, "Numeric Sorted Descending" )
Exit


Function _ArraySwap

Function Reference

_ArraySwap

Swaps two elements of an array.

#include <Array.au3>
_ArraySwap ( $sVector1, $sVector2 )

Parameters

$sVector1 | First element in the array to be swapped.
$sVector2 | Second element in the array to be swapped.

Return Value

None.

Remarks

This function swaps the 2 elements in place (they're passed by reference) and so don't do any error checking or returning of values.

Related

_ArrayReverse

Example

#include <Array.au3>

Dim $asArray[2]

$asArray[0] = "World!"
$asArray[1] = "Hello"

_ArrayDisplay( $asArray, "_ArraySwap() - BEFORE" )
_ArraySwap( $asArray[0], $asArray[1] )
_ArrayDisplay( $asArray, "_ArraySwap() - AFTER" )
Exit


Function _ArrayToClip

Function Reference

_ArrayToClip

Sends the contents of an array to the clipboard.

#include <Array.au3>
_ArrayToClip ( $avArray, $i_Base = 0)

Parameters

$avArray | The array to be sent to the clipboard.
$i_Base | Optional: Start Array index for sort, normally set to 0 or 1.

Return Value

Success: | Returns 1.
Failure: | Returns 0.
@Error: | 0 = No error.
 | 1 = The clipboard was cleared.

Remarks

None.

Related

_ArrayDisplay, _ArrayToString, StringSplit

Example

#include <Array.au3>
$asArray = StringSplit("a,b,c,d,e,f,g,h,i",",")
$iRetCode = _ArrayToClip( $asArray, 1 )
MsgBox( 4096, "_ArrayToClip() Test", ClipGet() )
Exit


Function _ArrayToString

Function Reference

_ArrayToString

Places the elements of an array into a single string, separated by the specified delimiter.

#include <Array.au3>
_ArrayToString ( $avArray, $sDelim [[, $iStart], $iEnd] )

Parameters

$avArray | The array to be converted into a string.
$sDelim | The delimiter to separate each element with.
$iStart | Optional (default to 0): An integer that specifies the element to start at in the array.
$iEnd | Optional (Default to Ubound): An integer that specifies the element to end at in the array.

Return Value

Success: | Returns a delimited string containing all elements in the array.
Failure: | Returns an empty string.
@Error: | 0 = No error.
 | 1 = $avArray isn't an array.
 | 2 = $avArray has less than 2 elements or it has more than 1 dimension.
 | 3 = $iStart isn't an integer.
 | 4 = $iStart is < 0.
 | 5 = $iEnd isn't an integer.
 | 6 = $iEnd is < 0.
 | 7 = $sDelim isn't a string
 | 8 = $sDelim is an empty string.
 | 9 = $sDelim has more than one delimiter.

Remarks

This function is the opposite of the StringSplit function with the extension of being able to take a subset of all of the elements and placing just that subset into the string.
Since this function is the inverse of the StringSplit function, the delimiter can't be larger than 1 character in length.

This function only accepts a 1 dimensional array.

If both $iStart and $iEnd = -1, then the entire array will be converted to a string.

Related

_ArrayToClip, _FileReadToArray, StringSplit

Example

#include <Array.au3>

Dim $avArray[11], $I = 0

; Populate test array.
For $I = 0 to UBound( $avArray ) - 1
$avArray[$I] = Int( Random( -20000, 20000 ) )
Next

_ArrayDisplay( $avArray, "_ArrayToString() Test" )

Dim $sArrayString = _ArrayToString( $avArray,@TAB, 1, 7 )
MsgBox( 4096, "_ArrayToString() Test", $sArrayString )
Exit


Function _ArrayTrim

Function Reference

_ArrayTrim

Trims all elements in an array a certain number of characters.

#include <Array.au3>
_ArrayTrim( $aArray, $iTrimNum [, $iTrimDirection], $iBase], $iUbound]]] )

Parameters

$aArray | The array to trim the items of.
$iTrimNum | The amount of characters to trim.
$iTrimDirection | Optional: Default=0. 0 to trim left, 1 to trim right
$i_Base | Optional: Start Array index for sort, normally set to 0 or 1.
$i_Ubound | Optional: Set the UBound for sorting which will only sort the defined number of entries in stead of the whole array.

Return Value

0 | If invalid array
1 | Invalid base boundry parameter
2 | Invalid end boundry parameter
3 | If $iTrimDirection is not a zero or a one
 | Otherwise it returns the new trimmed array

Remarks

None.

Related

None.

Example

#include <Array.au3>

Dim $avArray[5]
$avArray[0] = "ab"
$avArray[1] = "bc"
$avArray[2] = "cd"
$avArray[3] = "de"
$avArray[4] = "ef"

$aNewArray = _ArrayTrim( $avArray, 1, 1,1,3)
_ArrayDisplay($aNewArray,"demo _ArrayTrim")
Exit

;The new array in order should now be "a", "b" , "c" , "d", "e".


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: Color Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_ColorGetBlue | Returns the blue component of a given color.
_ColorGetGreen | Returns the green component of a given color.
_ColorGetRed | Returns the red component of a given color.


Function _ColorGetBlue

Function Reference

_ColorGetBlue

Returns the blue component of a given color.

#include <Color.au3>
_ColorGetBlue ( $nColor )

Parameters

$nColor The RGB color to work with (hexadecimal code).

Return Value

Success: | Returns the component color in the range 0-255.
Failure: | Returns -1.
@Error: | 0 = No error.
 | 1 = $nColor isn't a number.

Remarks

None.

Related

_ColorGetRed, _ColorGetGreen

Example

#include <Color.au3>

$iBlueColor = _ColorGetBlue( 0x8080ff )
MsgBox( 4096, "AutoIt", $iBlueColor )


Function _ColorGetGreen

Function Reference

_ColorGetGreen

Returns the green component of a given color.

#include <Color.au3>
_ColorGetGreen ( $nColor )

Parameters

$nColor The RGB color to work with (hexadecimal code).

Return Value

Success: | Returns the component color in the range 0-255.
Failure: | Returns -1.
@Error: | 0 = No error.
 | 1 = $nColor isn't a number.

Remarks

None.

Related

_ColorGetRed, _ColorGetBlue

Example

#include <Color.au3>

$iGreenColor = _ColorGetGreen( 0x8080ff )
MsgBox( 4096, "AutoIt", $iGreenColor )


Function _ColorGetRed

Function Reference

_ColorGetRed

Returns the red component of a given color.

#include <Color.au3>
_ColorGetRed ( $nColor )

Parameters

$nColor The RGB color to work with (hexadecimal code).

Return Value

Success: | Returns the component color in the range 0-255.
Failure: | Returns -1.
@Error: | 0 = No error.
 | 1 = $nColor isn't a number.

Remarks

None.

Related

_ColorGetGreen, _ColorGetBlue

Example

#include <Color.au3>

$iRedColor = _ColorGetRed( 0x8080ff )
MsgBox( 4096, "AutoIt", $iRedColor )


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: Date Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_DateAdd | Calculates a new date based on a given date and add an interval.
_DateDayOfWeek | Returns the name of the weekday, based on the specified day.
_DateDaysInMonth | Returns the number of days in a month, based on the specified month and year.
_DateDiff | Returns the difference between 2 dates, expressed in the type requested.
_DateIsLeapYear | Checks a given year to see if it is a leap year.
_DateIsValid | Checks the given date to determine if it is a valid date.
_DateTimeFormat | Returns the date in the PC's regional settings format.
_DateTimeSplit | Split a string containing Date and Time into two separate Arrays.
_DateToDayOfWeek | Returns the weekdaynumber for a given date.
_DateToDayOfWeekISO | Returns the ISO weekdaynumber for a given date.
_DateToDayValue | Returns the daynumber since since noon 4713 BC January 1 for a given Gregorian date.
_DayValueToDate | Add the given days since noon 4713 BC January 1 and returns the Gregorian date.
_Now | Returns the current Date and Time in PC's format.
_NowCalc | Returns the current Date and Time in format YYYY/MM/DD HH:MM:SS for use in date calculations.
_NowCalcDate | Returns the current Date in format YYYY/MM/DD.
_NowDate | Returns the current Date in the Pc's format.
_NowTime | Returns the current Time in requested format.
_SetDate | Sets the current date of the system
_SetTime | Sets the current time of the system
_TicksToTime | Converts the specified tick amount to hours, minutes, and seconds.
_TimeToTicks | Converts the specified hours, minutes, and seconds to ticks.
_WeekNumberISO | Calculate the weeknumber of a given date.


Function _DateAdd

Function Reference

_DateAdd

Calculates a new date based on a given date and add an interval.

#include <Date.au3>
_DateAdd ( $sType, $iValToAdd, $sDate )

Parameters

$sType | D = Add number of days to the given date M = Add number of months to the given date Y = Add number of years to the given date w = Add number of weeks to the given date h = Add number of hours to the given date n = Add number of minutes to the given date s = Add number of seconds to the given date
$iValToAdd | number to be added
$sDate | Input date in the format "YYYY/MM/DD[ HH:MM:SS]"

Return Value

Success: | Newly calculated date.
Failure: | 0
@Error: | 0 = No error.
 | 1 = Invalid $sType
 | 2 = Invalid $iValToAdd
 | 3 = Invalid $sDate

Remarks

The function will not return an invalid date.
e.g When 3 months are added to '2004/1/31' then the result will be 2004/04/30

Related

_DateDiff

Example

#include <Date.au3>

; Add 5 days to today
$sNewDate = _DateAdd( 'd',5, _NowCalcDate())
MsgBox( 4096, "", "Today + 5 days:" & $sNewDate )

; Subtract 2 weeks from today
$sNewDate = _DateAdd( 'w',-2, _NowCalcDate())
MsgBox( 4096, "", "Today minus 2 weeks: " & $sNewDate )

; Add 15 minutes to current time
$sNewDate = _DateAdd( 'n',15, _NowCalc())
MsgBox( 4096, "", "Current time +15 minutes: " & $sNewDate )

; Calculated eventlogdate which returns second since 1970/01/01 00:00:00
$sNewDate = _DateAdd( 's',1087497645, "1970/01/01 00:00:00")
MsgBox( 4096, "", "Date: " & $sNewDate )


Function _DateDayOfWeek

Function Reference

_DateDayOfWeek

Returns the name of the weekday, based on the specified day.

#include <Date.au3>
_DateDayOfWeek ( $iDayNum [, $iFormat] )

Parameters

$iDayNum | Day number (1 = Sunday, 7 = Saturday).
$iFormat | Optional - Format: 0 = Long name of the weekday. 1 = Abbreviated name of the weekday.

Return Value

Success: | Returns the name of the given weekday.
Failure: | Returns an empty string.
@Error: | 0 = No error.
 | 1 = Invalid day number or format.

Remarks

This function returns English day names only.

Related

_DateDaysInMonth

Example

#include <Date.au3>

; Retrieve the long name
$sLongDayName = _DateDayOfWeek( @WDAY )

; Retrieve the abbreviated name
$sShortDayName = _DateDayOfWeek( @WDAY, 1 )

MsgBox( 4096, "Day of Week", "Today is: " & $sLongDayName & " (" & $sShortDayName & ")" )


Function _DateDaysInMonth

Function Reference

_DateDaysInMonth

Returns the number of days in a month, based on the specified month and year.

#include <Date.au3>
_DateDaysInMonth ( $iYear, $iMonthNum )

Parameters

$iYear | 4-digit year.
$iMonthNum | Month number (1 = January, 12 = December).

Return Value

Success: | Returns the number of days in the month.
Failure: | Returns 0.
@Error: | 0 = No error.
 | 1 = Invalid month number or year.

Remarks

None.

Related

None.

Example

#include <Date.au3>

$iDays = _DateDaysInMonth( @YEAR,@MON )
MsgBox( 4096, "Days in Month", "This month has " & String( $iDays ) & " days in it." )


Function _DateDiff

Function Reference

_DateDiff

Returns the difference between 2 dates, expressed in the type requested.

#include <Date.au3>
_DateDiff($sType, $sStartDate, $sEndDate)

Parameters

$sType | D = Difference in days between the given dates M = Difference in months between the given dates Y = Difference in years between the given dates w = Difference in Weeks between the given dates h = Difference in hours between the given dates n = Difference in minutes between the given dates s = Difference in seconds between the given dates
$sStartDate | Input date in the format "YYYY/MM/DD[ HH:MM:SS]"
$sEndDate | Input End date in the format "YYYY/MM/DD[ HH:MM:SS]"

Return Value

Success: | Difference between the 2 dates.
Failure: | 0
@Error: | 0 = No error.
 | 1 = Invalid $sType
 | 2 = Invalid $sStartDate
 | 3 = Invalid $sEndDate

Remarks

None.

Related

_DateAdd

Example

#include <Date.au3>

; Calculated the number of seconds since EPOCH (1970/01/01 00:00:00)
$iDateCalc = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc())
MsgBox( 4096, "", "Number of seconds since EPOCH: " & $iDateCalc )

; Calculated the number of Hours this year
$iDateCalc = _DateDiff( 'h',@YEAR & "/01/01 00:00:00",_NowCalc())
MsgBox( 4096, "", "Number of Hours this year: " & $iDateCalc )


Function _DateIsLeapYear

Function Reference

_DateIsLeapYear

Checks a given year to see if it is a leap year.

#include <Date.au3>
_DateIsLeapYear ( $iYear )

Parameters

$iYear The 4-digit year to check.

Return Value

Success: | Returns 1.
Failure: | Returns 0 if the year is not a leap year.
@Error: | 0 = No error.
 | 1 = Invalid year.

Remarks

None.

Related

None.

Example

#include <Date.au3>

If _DateIsLeapYear( @YEAR ) Then
MsgBox( 4096, "Leap Year", "This year is a leap year." )
Else
MsgBox( 4096, "Leap Year", "This year is not a leap year." )
EndIf


Function _DateIsValid

Function Reference

_DateIsValid

Checks the given date to determine if it is a valid date.

#include <Date.au3>
_DateIsValid ( $sDate )

Parameters

$sDate The date to be checked.

Return Value

Success: | Returns 1.
Failure: | Returns 0 if the specified date is not valid.

Remarks

This function takes a date input in one of the following formats:
"yyyy/mm/dd[ hh:mm[:ss]]" or "yyyy/mm/dd[Thh:mm[:ss]]"
"yyyy-mm-dd[ hh:mm[:ss]]" or "yyyy-mm-dd[Thh:mm[:ss]]"
"yyyy.mm.dd[ hh:mm[:ss]]" or "yyyy.mm.dd[Thh:mm[:ss]]"

Related

None.

Example

#include <Date.au3>

$sDate = @YEAR & "/" & @MON & "/" & @MDAY

If _DateIsValid( $sDate ) Then
MsgBox( 4096, "Valid Date", "The specified date is valid." )
Else
MsgBox( 4096, "Valid Date", "The specified date is invalid." )
EndIf


Function _DateTimeFormat

Function Reference

_DateTimeFormat

Returns the date in the PC's regional settings format.

#Include <date.au3>
_DateTimeFormat ( $sDate, $sType)

Parameters

$sDate | Input date in the format "YYYY/MM/DD[ HH:MM:SS]"
$sType | 0 = Display a date and/or time. If there is a date part, display it as a short date. If there is a time part, display it as a long time. If present, both parts are displayed. 1 = Display a date using the long date format specified in your computer's regional settings. 2 = Display a date using the short date format specified in your computer's regional settings. 3 = Display a time using the time format specified in your computer's regional settings. 4 = Display a time using the 24-hour format (hh:mm). 5 = Display a time using the 24-hour format (hh:mm:ss).
$iValToAdd | number to be added

Return Value

Success: | Returns date in proper format.
Failure: | 0
@Error: | 0 = No error.
 | 1 = Invalid $sDate
 | 2 = Invalid $sType

Remarks

None.

Related

None.

Example

#include <Date.au3>

; Show current date/time in the pc's format
MsgBox( 4096, "Pc Long format", _DateTimeFormat( _NowCalc(),1))
MsgBox( 4096, "Pc Short format", _DateTimeFormat( _NowCalc(),2))


Function _DateTimeSplit

Function Reference

_DateTimeSplit

Split a string containing Date and Time into two separate Arrays.

#include <date.au3>
_DateTimeSplit($sDate, ByRef $asDatePart, ByRef $iTimePart)

Parameters

$sDate | Any of these formats: "yyyy/mm/dd[ hh:mm[:ss]]" "yyyy/mm/dd[Thh:mm[:ss]]" "yyyy-mm-dd[ hh:mm[:ss]]" "yyyy-mm-dd[Thh:mm[:ss]]" "yyyy.mm.dd[ hh:mm[:ss]]" "yyyy.mm.dd[Thh:mm[:ss]]"
$asDatePart | array that contains the Date. $asDatePart[0] number of values returned
$asTimePart | array that contains the Time. $asTimePart[0] number of values returned

Return Value

Success: | Date and Time into two separate Arrays.
Failure: | 0
@Error: | 0 = No error.
 | 1 = Invalid Input Date

Remarks

None.

Related

_DayValueToDate, _DateAdd, _DateDiff

Example

#include <Date.au3>

Dim $MyDate
Dim $MyTime
_DateTimeSplit("2005/01/01 14:30",$MyDate,$MyTime)

For $x = 1 to $MyDate[0]
MsgBox(0,$x,$MyDate[$x])
Next
For $x = 1 to $MyTime[0]
MsgBox(0,$x,$MyTime[$x])
Next


Function _DateToDayOfWeek

Function Reference

_DateToDayOfWeek

Returns the weekdaynumber for a given date.

#include <date.au3>
_DateToDayOfWeek ( $iYear, $iMonth, $iDay )

Parameters

$iYear | A valid year in format YYYY
$iMonth | A valid month in format MM
$iDay | A valid day in format DD

Return Value

Success: | Returns Day of the Week Range is 1 to 7 where 1=Sunday.
Failure: | 0
@Error: | 0 = No error.
 | 1 = Invalid Input Date

Remarks

None.

Related

_DateToDayOfWeekISO, _DateDayOfWeek, _DayValueToDate, _DateAdd, _DateDiff

Example

#include <Date.au3>

; Week day number for a given date
$iWeekday = _DateToDayOfWeek (@YEAR, @MON, @MDAY)
; Should be equal to @Wday
MsgBox(4096, "", "Todays WeekdayNumber is: " & $iWeekDay)
MsgBox(4096, "", "Today is a : " & _DateDayOfWeek($iWeekDay))


Function _DateToDayOfWeekISO

Function Reference

_DateToDayOfWeekISO

Returns the ISO weekdaynumber for a given date.

#include <date.au3>
_DateToDayOfWeekISO ( $iYear, $iMonth, $iDay )

Parameters

$iYear | A valid year in format YYYY
$iMonth | A valid month in format MM
$iDay | A valid day in format DD

Return Value

Success: | Returns Day of the Week Range is 0 to 6 where 0=Monday.
Failure: | 0
@Error: | 0 = No error.
 | 1 = Invalid Input Date

Remarks

None.

Related

_DateToDayOfWeek, _DateDayOfWeek, _DayValueToDate, _DateAdd, _DateDiff

Example

#include <Date.au3>
; ISO Week day number for a given date 0=Monday - 6=Sunday
$iWeekday = _DateToDayOfWeekISO (@YEAR, @MON, @MDAY)
; NOT equal to @Wday
MsgBox(4096, "", "Todays ISO WeekdayNumber is: " & $iWeekDay)


Function _DateToDayValue

Function Reference

_DateToDayValue

Returns the daynumber since since noon 4713 BC January 1 for a given Gregorian date.

#include <date.au3>
_DateToDayValue ( $iYear, $iMonth, $iDay )

Parameters

$iYear | A valid year in format YYYY
$iMonth | A valid month in format MM
$iDay | A valid day in format DD

Return Value

Success: | Returns the Juliandate (days since noon 4713 BC January 1)
Failure: | 0
@Error: | 0 = No error.
 | 1 = Invalid Input Date

Remarks

None.

Related

_DayValueToDate, _DateAdd, _DateDiff

Example

#include <Date.au3>

; Julian date of today.
$sJulDate = _DateToDayValue (@YEAR, @MON, @MDAY)
MsgBox(4096, "", "Todays Julian date is: " & $sJulDate)

; 14 days ago calculation.
Dim $Y, $M, $D
$sJulDate = _DayValueToDate ($sJulDate-14, $Y, $M, $D)
MsgBox(4096, "", "14 days ago:" & $M & "/" & $D & "/" & $Y)


Function _DayValueToDate

Function Reference

_DayValueToDate

Add the given days since noon 4713 BC January 1 and returns the Gregorian date.

#include <Date.au3>
_DateToDayValue ($iJulianDate, ByRef $iYear, ByRef $iMonth, ByRef $iDay)

Parameters

$iJulianDate | A valid number of days.
$iYear | will return the year in format YYYY
$iMonth | will return the month in format MM
$iDay | will return the day in format DD

Return Value

Success: | Returns the date calculate
Failure: | 0
@Error: | 0 = No error.
 | 1 = Invalid Input number of days

Remarks

None.

Related

_DateToDayValue, _DateAdd, _DateDiff

Example

#include <Date.au3>

; Julian date of today.
$sJulDate = _DateToDayValue (@YEAR, @MON, @MDAY)
MsgBox(4096, "", "Todays Julian date is: " & $sJulDate)

; 14 days ago calculation.
Dim $Y, $M, $D
$sJulDate = _DayValueToDate ($sJulDate-14, $Y, $M, $D)
MsgBox(4096, "", "14 days ago:" & $M & "/" & $D & "/" & $Y & " (" & $sJulDate & ")")


Function _Now

Function Reference

_Now

Returns the current Date and Time in PC's format.

#Include <Date.au3>
_Now()

Parameters

None.

Return Value

Returns the current Date and Time in PC's format

Remarks

If Date format isn't found in the registry it returns the date in the mm/dd/yyyy format.
If Time format isn't found in the registry it returns the time in the hh:mm:ss format.

Related

None.

Example

#include <Date.au3>

MsgBox( 4096, "", "Todays date/Time: " & _Now() )


Function _NowCalc

Function Reference

_NowCalc

Returns the current Date and Time in format YYYY/MM/DD HH:MM:SS for use in date calculations.

#Include <Date.au3>
_NowCalc()

Parameters

None.

Return Value

Returns the current Date and Time in format YYYY/MM/DD HH:MM:SS

Remarks

None.

Related

None.

Example

#include <Date.au3>

; Calculated the number of seconds since EPOCH (1970/01/01 00:00:00)
$iDateCalc = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc())
MsgBox( 4096, "", "Number of seconds since EPOCH: " & $iDateCalc )

; Calculated the number of Hours this year
$iDateCalc = _DateDiff( 'h',@YEAR & "/01/01 00:00:00",_NowCalc())
MsgBox( 4096, "", "Number of Hours this year: " & $iDateCalc )


Function _NowCalcDate

Function Reference

_NowCalcDate

Returns the current Date in format YYYY/MM/DD.

#Include <Date.au3>
_NowCalcDate()

Parameters

None.

Return Value

Returns the current Date in format YYYY/MM/DD

Remarks

None.

Related

None.

Example

#include <Date.au3>
$Msg = "Test record"
FileWriteLine("Pgm.log",_NowCalcDate() & " :" & $Msg )


Function _NowDate

Function Reference

_NowDate

Returns the current Date in the Pc's format.

#Include <date.au3>
_NowDate()

Parameters

None.

Return Value

Returns the current Date in the Pc's format.

Remarks

If Date format isn't found in the registry it returns the date in the mm/dd/yyyy format.

Related

_DateTimeFormat, _Now, _NowCalc, _NowCalcDate, _NowTime

Example

#include <Date.au3>
MsgBox(0,'',"The Date is:" & _NowDate())


Function _NowTime

Function Reference

_NowTime

Returns the current Time in requested format.

#Include <Date.au3>
_NowTime([$sType])

Parameters

$sType
Default: 3 = Display a time using the time format specified in your computer's regional settings.
4 = Display a time using the 24-hour format (hh:mm).
5 = Display a time using the 24-hour format (hh:mm:ss).

Return Value

Returns the current Time in PC's time format.

Remarks

If Time format isn't found in the registry it returns the time in the hh:mm:ss format.

Related

_DateTimeFormat, _Now, _NowDate, _NowCalc, _NowCalcDate

Example

#include <Date.au3>
MsgBox(0,'',"The time is:" & _NowTime())


Function _SetDate

Function Reference

_SetDate

Sets the current date of the system

#include <Date.au3>
_SetDate($iDay[, $iMonth=0 [, $iYear=0]])

Parameters

$iDay | Day of the month. Values: 1-31
$iMonth | Optional: month. Values: 1-12
$iYear | Optional: year. Values: > 0 (windows might restrict this further!!)

Return Value

Success: | 1
Failure: | 0
@Error: | 0 = No error.
 | 1 = Failure
@extended | GetLastError() Error code(s): http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes.asp

Remarks

If the optional parameters (iMonth,iYear) are NOT defined, the function will not change the current value!

Related

_SetTime

Example

#include <Date.au3>

_SetDate(20) ; Set the current date to 20-xx-xxxx
_SetDate(20,10) ; Set the current date to 20-10-xxxx
_SetDate(20,10,2004) ; Set the current date to 20-10-2004


Function _SetTime

Function Reference

_SetTime

Sets the current time of the system

#include <Date.au3>
_SetTime($iHour, $iMinute [, $iSecond=0])

Parameters

$iHour | the hour. Values: 0-23
$iMinute | the minute. Values: 0-59
$iSecond | Optional: the seconds. Values: 0-59

Return Value

Success: | 1
Failure: | 0
@Error: | 0 = No error.
 | 1 = Failure
@extended | GetLastError() Error code(s): http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes.asp

Remarks

If the optional parameter (iSecond) is NOT defined, the function will not change the current value!

Related

_SetDate

Example

#include <Date.au3>

_SetTime(20,15) ; Set time to 20:15
_SetTime(20,15,30) ; Set time to 20:15:30


Function _TicksToTime

Function Reference

_TicksToTime

Converts the specified tick amount to hours, minutes, and seconds.

#Include <Date.au3>
_TicksToTime ( $iTicks, $iHours, $iMins, $iSecs )

Parameters

$iTicks | Tick amount.
$iHours | Variable to store the hours.
$iMins | Variable to store the minutes.
$iSecs | Variable to store the seconds.

Return Value

Success: | Returns 1.
Failure: | Returns 0.
@Error: | 0 = No error.
 | 1 = $iTicks isn't an integer.

Remarks

None.

Related

_TimeToTicks

Example

; *** Demo to show a timer window
#include <GUIConstants.au3>
#include <Date.au3>
opt("TrayIconDebug",1)
Global $Secs, $Mins, $Hour, $Time
;Create GUI
GUICreate("Timer",120, 50)
GUICtrlCreateLabel("00:00:00", 10,10)
GUISetState()
;Start timer
$timer = TimerInit()
AdlibEnable("Timer", 50)
;
While 1
;FileWriteLine("debug.log",@min & ":" & @sec & " ==> before")
$msg = GUIGetMsg()
;FileWriteLine("debug.log",@min & ":" & @sec & " ==> after")
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
Wend
;
Func Timer()
_TicksToTime(Int(TimerDiff($timer)), $Hour, $Mins, $Secs )
Local $sTime = $Time ; save current time to be able to test and avoid flicker..
$Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
If $sTime <> $Time Then ControlSetText("Timer", "", "Static1", $Time)
EndFunc ;==>Timer


Function _TimeToTicks

Function Reference

_TimeToTicks

Converts the specified hours, minutes, and seconds to ticks.

#include <Date.au3>
_TimeToTicks([$iHours = @Hour, [$iMins = @Min, [$iSecs = @Sec]]])

Parameters

$iHours | The hours.
$iMins | The minutes.
$iSecs | The seconds.

Return Value

Success: | Returns the number of ticks.
Failure: | Returns 0.
@Error: | 0 = No error.
 | 1 = The specified hours, minutes, or seconds are not valid.

Remarks

None.

Related

_TicksToTime

Example

#include <Date.au3>
Global $Sec, $Min, $Hour, $Time
; calculate with time
$StartTicks = _TimeToTicks(@HOUR,@MIN,@SEC)
; calculate 45 minutes later
$EndTicks = $StartTicks + 45 * 60 * 1000
_TicksToTime($EndTicks,$Hour,$Min,$Sec)
MsgBox(262144,'' , 'New Time:' & $Hour & ":" & $Min & ":" & $Sec)


Function _WeekNumberISO

Function Reference

_WeekNumberISO

Calculate the weeknumber of a given date.

#include <Date.au3>
_WeekNumberISO($iYear=@YEAR, $iMonth=@MON, $iDay=@MDAY)

Parameters

$iYear | Year value (default = current year)
$iMonth | Month value (default = current month)
$iDay | Day value (default = current day)
$iWeekstart | Week starts from Sunday (0, default) or Monday (1)

Return Value

Success: | Returns week number of given date
Failure: | -1
@Error: | 0 = No error.
 | 1 = faulty parameters values
 | 99 = On non-acceptable weekstart value

Remarks

None.

Related

None.

Example

#include <Date.au3>

MsgBox(0,"Todays weeknumber","Todays weeknumber is " & _WeekNumberISO())


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: File Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_FileCountLines | Returns the number of lines in the specified file.
_FileCreate | Creates or zero's out the length of the file specified.
_FileListToArray | lists files and\or folders in a specified path (Similar to using Dir with the /B Switch)
_FilePrint | Prints a plain text file.
_FileReadToArray | Reads the specified file into an array.
_FileWriteFromArray | Writes Array records to the specified file.
_FileWriteLog | Writes current date,time and the specified text to a log file.
_FileWriteToLine | Writes text to a specific line in a file.
_PathFull | Creates a path based on the relative path you provide. The newly created absolute path is returned
_PathMake | Creates a path from drive, directory, file name and file extension parts. Not all parts must be passed.
_PathSplit | Splits a path into the drive, directory, file name and file extension parts. An empty string is set if a part is missing.
_ReplaceStringInFile | Replaces a string with another string in the given text file (binary won't work!)
_TempFile | Generate a name for a temporary file. The file is guaranteed not to exist yet.


Function _FileCountLines

Function Reference

_FileCountLines

Returns the number of lines in the specified file.

#include <File.au3>
_FileCountLines( $sFilePath )

Parameters

$sFilePath Path and filename of the file to be read

Return Value

Success: | Returns number of lines in the file.
Failure: | Returns a 0
@Error: | 0 = No error.
 | 1 = File cannot be opened or found.

Remarks

It does not count a final @LF as a line.

Related

None.

Example

#include <file.au3>
$CountLines = _FileCountLines("error.log")
MsgBox(64, "Error log recordcount", "There are " & $CountLines & " in the error.log.")
Exit


Function _FileCreate

Function Reference

_FileCreate

Creates or zero's out the length of the file specified.

#include <File.au3>
_FileCreate ( $sFilePath )

Parameters

$sFilePath Path and filename of the file to be created.

Return Value

Success: | Returns a 1
Failure: | Returns a 0
@Error: | 0 = No error.
 | 1 = Error opening specified file
 | 2 = File could not be written to

Remarks

None.

Related

FileOpen

Example

#include <File.au3>
If Not _FileCreate("error.log") Then
MsgBox(4096,"Error", " Error Creating/Resetting log. error:" & @error)
EndIf


Function _FileListToArray

Function Reference

_FileListToArray

lists files and\or folders in a specified path (Similar to using Dir with the /B Switch)

#include <File.au3>
_FileListToArray($sPath [, $sFilter [, $iFlag]])

Parameters

$sPath | Path to generate filelist for.
$sFilter | Optional the filter to use, default is *. Search the Autoit3 helpfile for the word "WildCards" For details.
$iFlag | Optional: specifies wheather to return files folders or both $iFlag=0(Default) Return both files and folders $iFlag=1 Return files only $iFlag=2 Return Folders only

Return Value

@Error: | 1 = Path not found or invalid
 | 2 = Invalid $sFilter
 | 3 = Invalid $iFlag
 | 4 = No File(s) Found

Remarks

The array returned is one-dimensional and is made up as follows:
$array[0] = Number of Files\Folders returned
$array[1] = 1st File\Folder
$array[2] = 2nd File\Folder
$array[3] = 3rd File\Folder
$array[n] = nth File\Folder

Related

None.

Example

#Include <File.au3>
#Include <Array.au3>
$FileList=_FileListToArray(@DesktopDir)
If (Not IsArray($FileList)) and (@Error=1) Then
MsgBox (0,"","No Files\Folders Found.")
Exit
EndIf
_ArrayDisplay($FileList,"$FileList")


Function _FilePrint

Function Reference

_FilePrint

Prints a plain text file.

#include <File.au3>
_FilePrint ( $s_File [, $i_Show] )

Parameters

$s_File | The file to print.
$i_Show | The state of the window. (default = @SW_HIDE)

Return Value

Success: | Returns 1.
Failure: | Returns 0 and sets @error according to the global constants list.

Remarks

Uses the ShellExecute function of shell32.dll.

Related

None.

Example

#include <File.au3>

$file = FileOpenDialog("Print File", "", "Text Documents (*.txt)", 1)
If @error Then Exit

$print = _FilePrint($file)
If $print Then
MsgBox(0, "Print", "The file was printed.")
Else
MsgBox(0, "Print", "Error: " & @error & @CRLF & "The file was not printed.")
EndIf


Function _FileReadToArray

Function Reference

_FileReadToArray

Reads the specified file into an array.

#include <File.au3>
_FileReadToArray($sFilePath, $aArray)

Parameters

$sFilePath | Path and filename of the file to be read.
$aArray | The array to store the contents of the file.

Return Value

Success: | Returns a 1
Failure: | Returns a 0
@Error: | 0 = No error.
 | 1 = Error opening specified file

Remarks

$aArray[0] will contain the number of records read into the array.

Related

_FileWriteFromArray

Example

#include <file.au3>
Dim $aRecords
If Not _FileReadToArray("error.log",$aRecords) Then
MsgBox(4096,"Error", " Error reading log to Array error:" & @error)
Exit
EndIf
For $x = 1 to $aRecords[0]
Msgbox(0,'Record:' & $x, $aRecords[$x])
Next


Function _FileWriteFromArray

Function Reference

_FileWriteFromArray

Writes Array records to the specified file.

#include <File.au3>
_FileWriteFromArray($sFilePath, $a_Array [,$i_Base [, $i_UBound ]])

Parameters

$sFilePath | Path and filename of the file to write to.
$a_Array | The array to be written to the file.
$i_Base | Optional: Start Array index to read, normally set to 0 or 1. Default=0
$i_Ubound | Optional: Set to the last record you want to write to the File. default=0 - whole array.

Return Value

Success: | Returns a 1
Failure: | Returns a 0
@Error: | 0 = No error.
 | 1 = Error opening specified file
 | 2 = Input is not an Array

Remarks

None.

Related

_FileReadToArray

Example

#include<Array.au3>
#include<File.au3>
Dim $a_Test
; Read file into array
_FileReadToArray("test.txt",$a_Test)
; reverse records
_ArrayReverse($a_Test,1)
; write reversed array to file
_FileWriteFromArray("test2.txt",$a_Test,1)


Function _FileWriteLog

Function Reference

_FileWriteLog

Writes current date,time and the specified text to a log file.

#include <File.au3>
_FileWriteLog( $sLogPath, $sLogMsg )

Parameters

$sFilePath | Path and filename of the file to be written to
$sLogMsg | Message to be written to the log file

Return Value

Success: | Returns a 1
Failure: | Returns a 0
@Error: | 0 = No error.
 | 1 = Error opening specified file
 | 2 = File could not be written to

Remarks

None.

Related

FileOpen

Example

#include <file.au3>
;
_FileWriteLog(@ScriptDir & "\my.log","Text 1")
;
_FileWriteLog(@ScriptDir & "\my.log","Text 2")


Function _FileWriteToLine

Function Reference

_FileWriteToLine

Writes text to a specific line in a file.

#include <File.au3>
_FileWriteToLine($sFile, $iLine, $sText[, $fOverWrite])

Parameters

$sFile | The file to write to
$iLine | The line number to write to
$sText | The text to write
$fOverWrite | if set to 1 will overwrite the old line if set to 0 will not overwrite

Return Value

Success: | 1
Failure: | 0
@Error: | 0 = No error
 | 1 = File has less lines than $iLine
 | 2 = File does not exist
 | 3 = Error when opening file
 | 4 = $iLine is invalid
 | 5 = $fOverWrite is invalid
 | 6 = $sText is invalid

Remarks

If _FileWriteToLine is called with $fOverWrite as 1 and $sText as "", it will delete the line.

Related

None.

Example

#include <File.au3>
;Example: Write to line 3 of c:\test.txt REPLACING line 3
_FileWriteToLine("c:\test.txt", 3, "my replacement for line 3", 1)
;Example: Write to line 3 of c:\test.txt NOT REPLACING line 3
_FileWriteToLine("c:\test.txt", 3, "my insertion", 0)


Function _PathFull

Function Reference

_PathFull

Creates a path based on the relative path you provide. The newly created absolute path is returned

#include <File.au3>
_PathFull($szRelPath)

Parameters

$szRelPath The relative path to be created

Return Value

Returns the newly created absolute path.

Remarks

None.

Related

_PathMake, _PathSplit, DirCreate, FileChangeDir

Example

#include <file.au3>
$TestPath = _PathFull(@ScriptDir & "..\..\test")
MsgBox(0,"demo _PathFull",@ScriptDir & @lf & $TestPath)


Function _PathMake

Function Reference

_PathMake

Creates a path from drive, directory, file name and file extension parts. Not all parts must be passed.
The path will still be built with what is passed. This doesn't check the validity of the path created, it could contain characters which are invalid on your filesystem.

#include <File.au3>
_PathMake($szDrive, $szDir, $szFName, $szExt)

Parameters

$szDrive | Drive (Can be UNC). If it's a drive letter, a : is automatically appended
$szDir | Directory. A trailing slash is added if not found (No preceeding slash is added)
$szFName | The name of the file
$szExt | The file extension. A period is supplied if not found in the extension

Return Value

Returns the string containing the full path

Remarks

None.

Related

_PathFull, _PathSplit, DirCreate, FileChangeDir

Example

#include <file.au3>
;


Function _PathSplit

Function Reference

_PathSplit

Splits a path into the drive, directory, file name and file extension parts. An empty string is set if a part is missing.

#include <File.au3>
_PathSplit($szPath, ByRef $szDrive, ByRef $szDir, ByRef $szFName, ByRef $szExt)

Parameters

$szPath | The path to be split (Can contain a UNC server or drive letter)
$szDrive | String to hold the drive
$szDir | String to hold the directory
$szFName | String to hold the file name
$szExt | String to hold the file extension

Return Value

Returns an array with 5 elements where 0 = original path, 1 = drive, 2 = directory, 3 = filename, 4 = extension

Remarks

None.

Related

_PathFull, _PathMake

Example

#include <file.au3>
#include <array.au3>
Dim $szDrive, $szDir, $szFName, $szExt
$TestPath = _PathSplit(@ScriptFullPath, $szDrive, $szDir, $szFName, $szExt)
_ArrayDisplay($TestPath,"Demo _PathSplit()")


Function _ReplaceStringInFile

Function Reference

_ReplaceStringInFile

Replaces a string with another string in the given text file (binary won't work!)

#include <File.au3>
_ReplaceStringInFile($szFileName, $szSearchString, $szReplaceString, $fCaseness = 0, $fOccurance = 1)

Parameters

$szFileName | name of the file to open. ATTENTION !! Needs the FULL path, not just the name returned by eg. FileFindNextFile
$szSearchString | The string we want to replace in the file
$szReplaceString | The string we want as a replacement for $szSearchString
$fCaseness | 0 = Not Case sensitive (default), 1 = Case sensitive, case does matter
$fOccurance | 0 = Only first found is replaced, 1 = ALL occurrences are replaced (default)

Return Value

Success: | Returns the number of occurrences of $szSearchString we found
Failure: | Returns -1 and sets @error
 | @error=1 - Cannot open file
 | @error=2 - Cannot open temp file
 | @error=3 - Cannot write to temp file
 | @error=4 - Cannot delete original file
 | @error=5 - Cannot rename/move temp file

Remarks

None.

Related

None.

Example

#include <File.au3>

$find = "BEFORE"
$replace = "AFTER"

$filename = "C:\_ReplaceStringInFile.test"

$msg = "Hello Test " & $find & " Hello Test" & @CRLF
$msg &= "Hello Test" & @CRLF
$msg &= @CRLF
$msg &= $find

FileWrite($filename, $msg )

msgbox(0,"BEFORE",$msg)

$retval = _ReplaceStringInFile($filename,$find,$replace)
if $retval = -1 then
msgbox(0, "ERROR", "The pattern could not be replaced in file: " & $filename & " Error: " & @error)
exit
else
msgbox(0, "INFO", "Found " & $retval & " occurances of the pattern: " & $find & " in the file: " & $filename)
endif

$msg = FileRead($filename, 1000)
msgbox(0,"AFTER",$msg)
FileDelete($filename)


Function _TempFile

Function Reference

_TempFile

Generate a name for a temporary file. The file is guaranteed not to exist yet.

#include <File.au3>
_TempFile ( [$s_DirectoryName=@TempDIr [, $s_FilePrefix [, $s_FileExtension [, $i_RandomLength]]]] )

Parameters

$s_DirectoryName | Optional: Name of directory for filename, defaults to the users %TEMP% directory
$s_FilePrefix | Optional: File prefixname, defaults to "~"
$s_FileExtension | Optional: File extenstion, defaults to ".tmp"
$i_RandomLength | Optional: Number of characters to use to generate a unique name, defaults to 7

Return Value

Filename of a temporary file which does not exist

Remarks

None.

Related

None.

Example

#include <File.au3>

Dim $s_TempFile, $s_FileName

; generate unique filename in @TempDir
$s_TempFile = _TempFile()

; generate unique filename in given directory and starting with tst_
$s_FileName = _TempFile("C:\", "tst_", ".txt", 7)

MsgBox(4096, "Info", "Names suitable for new temporary file : " & @LF & $s_TempFile & @LF & $s_FileName)

Exit


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: GuiCombo Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_GUICtrlComboAddDir | Add names to the list displayed by the combo box
_GUICtrlComboAddString | Add a string to the list box of a combo box
_GUICtrlComboAutoComplete | AutoComplete a combo box input
_GUICtrlComboDeleteString | Delete a string in the list box of a combo box
_GUICtrlComboFindString | Return the index of matching item
_GUICtrlComboGetCount | Retrieve the number of items in the list box of a combo box
_GUICtrlComboGetCurSel | Retrieve the index of the currently selected item, if any, in the list box of a combo box
_GUICtrlComboGetDroppedControlRect | Retrieve the screen coordinates of a combo box in its dropped-down state.
_GUICtrlComboGetDroppedState | Determine whether the list box of a combo box is dropped down
_GUICtrlComboGetDroppedWidth | Retrieve the minimum allowable width, of the list box of a combo box
_GUICtrlComboGetEditSel | Get the starting and ending character positions of the current selection in the edit control of a combo box.
_GUICtrlComboGetExtendedUI | Determine whether a combo box has the default user interface or the extended user interface
_GUICtrlComboGetHorizontalExtent | Retrieve from a combo box the width, in pixels
_GUICtrlComboGetItemHeight | Determine the height of list items or the selection field in a combo box
_GUICtrlComboGetLBText | Retrieve a string from the list of a combo box.
_GUICtrlComboGetLBTextLen | Retrieve the length, in characters, of a string in the list of a combo box
_GUICtrlComboGetList | Retrieves all items from the list portion of a ComboBox control.
_GUICtrlComboGetLocale | Retrieve the current locale of the combo box
_GUICtrlComboGetMinVisible | Get the minimum number of visible items in the drop-down list of a combo box
_GUICtrlComboGetTopIndex | Retrieve the zero-based index of the first visible item in the list box portion of a combo box
_GUICtrlComboInitStorage | Allocates memory for storing list box portion of the combo box items
_GUICtrlComboInsertString | Insert a string into the list box of a combo box
_GUICtrlComboLimitText | Limit the length of the text the user may type into the edit control of a combo box
_GUICtrlComboResetContent | Remove all items from the list box and edit control of a combo box
_GUICtrlComboSelectString | Search the list of a combo box for an item that begins with the characters in a specified string
_GUICtrlComboSetCurSel | Select a string in the list of a combo box
_GUICtrlComboSetDroppedWidth | Set the maximum allowable width
_GUICtrlComboSetEditSel | Select characters in the edit control of a combo box
_GUICtrlComboSetExtendedUI | Select either the default user interface or the extended user interface
_GUICtrlComboSetHorizontalExtent | Set the width, in pixels
_GUICtrlComboSetItemHeight | Set the height of list items or the selection field in a combo box
_GUICtrlComboSetMinVisible | Set the minimum number of visible items in the drop-down list of a combo box
_GUICtrlComboSetTopIndex | Ensure that a particular item is visible
_GUICtrlComboShowDropDown | Show or hide the list box of a combo box


Function _GUICtrlComboAddDir

Function Reference

_GUICtrlComboAddDir

Add names to the list displayed by the combo box

#Include <GuiCombo.au3>
_GUICtrlComboAddDir(control id,"Attributes"[,"file"])

Parameters

$h_combobox | control id/control hWnd
$s_Attributes | comma-delimited string
$s_file | Optional for "Drives" only: what Files/Folders to get eg *.*

Return Value

Success: | Returns zero-based index of the last name added to the list.
Failure: | Returns $CB_ERR.
 | Returns $CB_ERRSPACE if there is insufficient space to store the new strings.

Remarks

Requirement: $s_file for all but drives attribute

$s_Attributes is an comma-delimited string
valid values are any of the following:
A,D,H,RO,RW,S,E,Drives,NB

A = ARCHIVE | Includes archived files.
D = DIRECTORY | Includes subdirectories. Subdirectory names are enclosed in square brackets ([ ]).
H = HIDDEN | Includes hidden files.
RO = READONLY | Includes read-only files.
RW = READWRITE | Includes read-write files with no additional attributes. This is the default setting.
S = SYSTEM | Includes system files.
E = EXCLUSIVE | Includes only files with the specified attributes. By default, read-write files are listed even if READWRITE is not specified.
DRIVES | All mapped drives are added to the list. Drives are listed in the form [-x-], where x is the drive letter.
NB = No Brackets | 0
Drives are listed in the form x:, where x is the drive letter (used with Drives attribute) | 0

Related

_GUICtrlComboInitStorage

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>
#Include <GuiStatusBar.au3>

Opt('MustDeclareVars', 1)

Dim $a_check[10], $msg, $ret, $s_attr, $allocated, $Status, $GUI
Dim $input, $group, $a_attr, $Combo, $button, $btn_exit

$GUI = GUICreate("ComboBox Add Dir", 400, 280)

GUICtrlCreateLabel("Enter files to find", 25, 15)
$input = GUICtrlCreateInput("", 125, 10, 180, 25)
$group = GUICtrlCreateGroup("Atrributes", 10, 40, -1, 200)
$a_attr = StringSplit("A,D,H,RO,RW,S,E,Drives,NB", ",")
$a_check[0] = 9
$a_check[1] = GUICtrlCreateCheckbox("Archive", 15, 55, 170, 20)
$a_check[2] = GUICtrlCreateCheckbox("Directory", 15, 75, 170, 20)
$a_check[3] = GUICtrlCreateCheckbox("Hidden", 15, 95, 170, 20)
$a_check[4] = GUICtrlCreateCheckbox("Read-Only", 15, 115, 170, 20)
$a_check[5] = GUICtrlCreateCheckbox("Read-Write", 15, 135, 95, 20)
$a_check[6] = GUICtrlCreateCheckbox("System", 15, 155, 170, 20)
$a_check[7] = GUICtrlCreateCheckbox("Exclusive", 15, 175, 170, 20)
$a_check[8] = GUICtrlCreateCheckbox("Drives", 15, 195, 170, 20)
$a_check[9] = GUICtrlCreateCheckbox("No Brackets (Drives Only)", 15, 215, 170, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

$Combo = GUICtrlCreateCombo("", 240, 40, 120, 120, $CBS_SIMPLE)
$allocated = _GUICtrlComboInitStorage ($Combo, 26, 50)

$button = GUICtrlCreateButton("Get Names", 240, 160, 120, 40)
$btn_exit = GUICtrlCreateButton("Exit", 240, 205, 120, 40)

$Status = _GUICtrlStatusBarCreate ($GUI, -1, "")
_GUICtrlStatusBarSetSimple ($Status)
_GUICtrlStatusBarSetText ($Status, "Pre-Allocated Memory For: " & $allocated & _
" Items Added To ComboBox: " & _GUICtrlComboGetCount ($Combo), 255)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $btn_exit
ExitLoop
Case $msg = $button
$s_attr = ""
For $i = 1 To $a_check[0]
If (BitAND(GUICtrlRead($a_check[$i]), $GUI_CHECKED)) Then
If (StringLen($s_attr) > 0) Then
$s_attr &= "," & $a_attr[$i]
Else
$s_attr = $a_attr[$i]
EndIf
EndIf
Next
_GUICtrlComboResetContent ($Combo)
$ret = _GUICtrlComboAddDir ($Combo, $s_attr, GUICtrlRead($input))
If ($ret < 0) Then
If ($ret == $CB_ERRATTRIBUTE) Then
MsgBox(16, "Error", "Invalid Attribute sent to _GUICtrlComboAddDir")
ElseIf ($ret == $CB_ERRSPACE) Then
MsgBox(16, "Error", "insufficient space to store the new strings from calling _GUICtrlComboAddDir")
ElseIf ($ret == $CB_ERRREQUIRED) Then
MsgBox(16, "Error", "Argument required for file search in call to _GUICtrlComboAddDir")
ElseIf ($ret == $CB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlComboAddDir" & @CRLF & "Possibly no files/folders found")
EndIf
EndIf
_GUICtrlStatusBarSetText ($Status, "Pre-Allocated Memory For: " & $allocated & _
" Items Added To ComboBox: " & _GUICtrlComboGetCount ($Combo), 255)
EndSelect
WEnd
Exit


Function _GUICtrlComboAddString

Function Reference

_GUICtrlComboAddString

Add a string to the list box of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboAddString($h_combobox,$s_text)

Parameters

$h_combobox | control id/control hWnd
$s_text | string to add

Return Value

Success: | Return zero-based index of the last name added to the list
Failure: | Returns $CB_ERR.
 | Returns $CB_ERRSPACE if there is insufficient space to store the new strings.

Remarks

If the combo box does not have the $CBS_SORT style,
the string is added to the end of the list.
Otherwise, the string is inserted into the list, and the list is sorted.

Related

_GUICtrlComboDeleteString, _GUICtrlComboInsertString, _GUICtrlComboResetContent

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Label,$Input,$Btn_Add,$Combo,$Btn_Exit,$msg

GuiCreate("ComboBox Add String", 392, 254)

$Label = GuiCtrlCreateLabel("Enter String to Add", 20, 20, 120, 20)
$Input = GuiCtrlCreateInput("", 160, 20, 180, 20)
$Btn_Add = GuiCtrlCreateButton("Add String", 210, 50, 90, 30)
$Combo = GuiCtrlCreateCombo("A", 70, 100, 270, 120)
GUICtrlSetData($Combo,"B|C|D|E|F")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)

GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Add
If(StringLen(GUICtrlRead($Input)) > 0) Then
_GUICtrlComboAddString($Combo,GUICtrlRead($Input))
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboAutoComplete

Function Reference

_GUICtrlComboAutoComplete

AutoComplete a combo box input

#Include <GuiCombo.au3>
_GUICtrlComboAutoComplete($h_combobox, ByRef $s_text)

Parameters

$h_combobox | control id/control hWnd
$s_text | String for comparing against the combo's input box

Return Value

None

Remarks

None.

Related

None.

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt ('MustDeclareVars', 1)

Dim $Combo, $Btn_Exit, $msg, $old_string = ""

GUICreate("ComboBox AutoComplete", 392, 254)

$Combo = GUICtrlCreateCombo("", 70, 100, 270, 120)
GUICtrlSetData($Combo, "AutoIt|v3|is|freeware|BASIC-like|scripting|language|Autobot|Animal")
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 180, 90, 30)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case Else
_GUICtrlComboAutoComplete ($Combo, $old_string)
EndSelect
WEnd
Exit


Function _GUICtrlComboDeleteString

Function Reference

_GUICtrlComboDeleteString

Delete a string in the list box of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboDeleteString($h_combobox, $i_index)

Parameters

h_combobox | control id/control hWnd
$i_index | Specifies the zero-based index of the string

Return Value

Success: | Returns value is a count of the strings remaining in the list.
Failure: | Returns $CB_ERR if the $i_index parameter specifies an index greater than the number of items in the list.

Remarks

None.

Related

_GUICtrlComboAddString, _GUICtrlComboInsertString, _GUICtrlComboResetContent

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo, $Btn_Delete, $Btn_Exit, $msg

GuiCreate("ComboBox Delete String", 392, 254)

$Combo = GuiCtrlCreateCombo("A", 70, 10, 270, 110,$CBS_SIMPLE)
$Btn_Delete = GuiCtrlCreateButton("Delete String", 135, 120, 90, 30)
GUICtrlSetData($Combo,"B|C|D|E|F")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)

GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Delete
If(_GUICtrlComboGetCurSel($Combo) <> $CB_ERR) Then
_GUICtrlComboDeleteString($Combo,_GUICtrlComboGetCurSel($Combo))
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboFindString

Function Reference

_GUICtrlComboFindString

Return the index of matching item

#Include <GuiCombo.au3>
_GUICtrlComboFindString($h_combobox,$s_search[,$i_exact=0])

Parameters

$h_combobox | control id/control hWnd
$s_search | string to search for
$i_exact | Optional: exact match or not

Return Value

Success: | Returns is the zero-based index of the matching item.
Failure: | Returns $CB_ERR if the search is unsuccessful.

Remarks

$i_exact = 0 Search the list box of a combo box for an item beginning with
the characters in a specified string
$i_exact <> 0 Find the first list box string in a combo box that matches
the string specified in the $s_search parameter

Related

_GUICtrlComboSelectString

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Label,$Input,$Btn_Search,$Btn_ExactSearch,$Combo,$Btn_Exit,$Status,$msg,$ret

GuiCreate("ComboBox Find String", 392, 254)

$Label = GuiCtrlCreateLabel("Enter Search String", 20, 20, 120, 20)
$Input = GuiCtrlCreateInput("", 160, 20, 180, 20)
$Btn_Search = GuiCtrlCreateButton("Search", 160, 50, 90, 30)
$Btn_ExactSearch = GuiCtrlCreateButton("Exact Search", 255, 50, 90, 30)
$Combo = GuiCtrlCreateCombo("", 70, 100, 270, 120)
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Search
If(StringLen(GUICtrlRead($Input)) > 0) Then
$ret = _GUICtrlComboFindString($Combo,GUICtrlRead($Input))
If($ret <> $CB_ERR) Then
GUICtrlSetData($Status,'Found "' & GUICtrlRead($Input) & '" at index: ' & $ret)
Else
GUICtrlSetData($Status,'"' & GUICtrlRead($Input) & '" Not Found')
EndIf
EndIf
Case $msg = $Btn_ExactSearch
If(StringLen(GUICtrlRead($Input)) > 0) Then
$ret = _GUICtrlComboFindString($Combo,GUICtrlRead($Input),1)
If($ret <> $CB_ERR) Then
GUICtrlSetData($Status,'Found "' & GUICtrlRead($Input) & '" at index: ' & $ret)
Else
GUICtrlSetData($Status,'"' & GUICtrlRead($Input) & '" Not Found')
EndIf
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboGetCount

Function Reference

_GUICtrlComboGetCount

Retrieve the number of items in the list box of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboGetCount($h_combobox)

Parameters

$h_combobox control id/control hWnd

Return Value

The return value is the number of items in the list box.

Remarks

The index is zero-based, so the returned count is one greater
than the index value of the last item.

Related

_GUICtrlComboAddString, _GUICtrlComboInsertString, _GUICtrlComboSelectString

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$ret,$Btn_Exit,$Status,$msg

GuiCreate("ComboBox Get Count", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 100,$CBS_SIMPLE)
$ret = _GUICtrlComboAddDir($Combo,"drives")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
GUICtrlSetData($Status,"Items in ComboBox: " & _GUICtrlComboGetCount($Combo))
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlComboGetCurSel

Function Reference

_GUICtrlComboGetCurSel

Retrieve the index of the currently selected item, if any, in the list box of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboGetCurSel($h_combobox)

Parameters

$h_combobox control id/control hWnd

Return Value

The return value is the zero-based index of the currently selected item.

Remarks

None.

Related

_GUICtrlComboSetCurSel, _GUICtrlComboInsertString, _GUICtrlComboSetTopIndex

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$ret,$Btn_Exit,$Status,$msg,$ret

GuiCreate("ComboBox Get Current Selection", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 100,$CBS_SIMPLE)
$ret = _GUICtrlComboAddDir($Combo,"drives")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Combo
$ret = _GUICtrlComboGetCurSel($Combo)
If($ret <> $CB_ERR) Then GUICtrlSetData($Status,"Items Selected (Index): " & $ret)
EndSelect
WEnd
Exit


Function _GUICtrlComboGetDroppedControlRect

Function Reference

_GUICtrlComboGetDroppedControlRect

Retrieve the screen coordinates of a combo box in its dropped-down state.

#Include <GuiCombo.au3>
_GUICtrlComboGetDroppedControlRect($h_combobox)

Parameters

$h_combobox control id/control hWnd

Return Value

Success: | Returns array containing the RECT, first element ($array[0]) contains the number of elements.
Failure: | Returns $CB_ERR if an error occurs.

Remarks

$array[1] - left
$array[2] - top
$array[3] - right
$array[4] - bottom

Related

_GUICtrlComboGetDroppedState, _GUICtrlComboGetDroppedWidth

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

opt('MustDeclareVars', 1)

Dim $Combo, $Btn_Exit, $msg, $label_rect, $s_rect, $Btn_GETRECT

GUICreate("ComboBox Get Dropped Control RECT", 392, 254)

$Combo = GUICtrlCreateCombo("", 70, 10, 270, 120)
GUICtrlSetData($Combo, "AutoIt|v3|is|freeware|BASIC-like|scripting|language|designed|for|automating|the Windows GUI.")

$Btn_GETRECT = GUICtrlCreateButton("Get Dropped Control Rect", 150, 130, 90, 40, $BS_MULTILINE)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 180, 90, 30)

$s_rect = "Left:" & @LF & "Top:" & @LF & "Right:" & @LF & "Bottom:"
$label_rect = GUICtrlCreateLabel($s_rect, 145, 50, 100, 55, $SS_SUNKEN)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_GETRECT
Local $rect_array = _GUICtrlComboGetDroppedControlRect($Combo)
If (IsArray($rect_array)) Then
$s_rect = "Left:" & $rect_array[1] & @LF & "Top:" & $rect_array[2] & @LF & "Right:" & $rect_array[3] & @LF & "Bottom:" & $rect_array[4]
GUICtrlSetData($label_rect, $s_rect)
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboGetDroppedState

Function Reference

_GUICtrlComboGetDroppedState

Determine whether the list box of a combo box is dropped down

#Include <GuiCombo.au3>
_GUICtrlComboGetDroppedState($h_combobox)

Parameters

$h_combobox control id/control hWnd

Return Value

Success: | Returns TRUE if the list box is visible.
Failure: | Returns FALSE otherwise.

Remarks

None.

Related

_GUICtrlComboGetDroppedWidth, _GUICtrlComboSetDroppedWidth, _GUICtrlComboShowDropDown

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$Btn_Exit,$Status,$msg,$state,$current

GuiCreate("ComboBox Dropped State", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 120)
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
GUICtrlSetData($Status,"Dropped State: False")
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case Else
$state = _GUICtrlComboGetDroppedState($Combo)
If($state And $state <> $current) Then
$current = $state
GUICtrlSetData($Status,"Dropped State: True")
ElseIf($state <> $current) Then
$current = $state
GUICtrlSetData($Status,"Dropped State: False")
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboGetDroppedWidth

Function Reference

_GUICtrlComboGetDroppedWidth

Retrieve the minimum allowable width, of the list box of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboGetDroppedWidth($h_combobox)

Parameters

$h_combobox control id/control hWnd

Return Value

None.

Remarks

Requirement: $CBS_DROPDOWN or $CBS_DROPDOWNLIST style

Related

_GUICtrlComboGetDroppedState, _GUICtrlComboSetDroppedWidth

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$Btn_Exit,$Status,$msg

GuiCreate("ComboBox Dropped Width", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 120)
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
GUICtrlSetData($Status,"Drop Width: " & _GUICtrlComboGetDroppedWidth($Combo))
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlComboGetEditSel

Function Reference

_GUICtrlComboGetEditSel

Get the starting and ending character positions of the current selection in the edit control of a combo box.

#Include <GuiCombo.au3>
_GUICtrlComboGetEditSel($h_combobox)

Parameters

$h_combobox control id/control hWnd

Return Value

Array containing the starting and ending selected positions, first element ($array[0]) contains the number of elements
If an error occurs, the return value is $CB_ERR.

Remarks

$array[1] - starting position
$array[2] - ending position

Related

_GUICtrlComboSetEditSel

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

opt('MustDeclareVars', 1)

Dim $Combo, $Btn_Exit, $msg, $Status

GUICreate("ComboBox Get Edit Sel", 392, 254)

$Combo = GUICtrlCreateCombo("", 70, 10, 270, 100, $CBS_SIMPLE)
GUICtrlSetData($Combo, "AutoIt|v3|is|freeware|BASIC-like|scripting|language", "freeware")
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 200, 90, 30)

$Status = GUICtrlCreateLabel("", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
Local $a_sel = _GUICtrlComboGetEditSel($Combo)
If (IsArray($a_sel)) Then
GUICtrlSetData($Status, "Chars Position Selected From: " & $a_sel[1] & " To: " & $a_sel[2])
EndIf

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlComboGetExtendedUI

Function Reference

_GUICtrlComboGetExtendedUI

Determine whether a combo box has the default user interface or the extended user interface

#Include <GuiCombo.au3>
_GUICtrlComboGetExtendedUI($h_combobox)

Parameters

$h_combobox control id/control hWnd

Return Value

Success: | Returns TRUE if the combo box has the extended user interface.
Failure: | Returns FALSE otherwise.

Remarks

By default, the F4 key opens or closes the list and the
DOWN ARROW changes the current selection.

In a combo box with the extended user interface, the F4
key is disabled and pressing the DOWN ARROW key opens the
drop-down list.

Related

_GUICtrlComboSetExtendedUI

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$Btn_Exit,$Status,$msg,$Btn_Standard,$Btn_Extended,$state,$current

GuiCreate("ComboBox Get Extended UI", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 120)
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language")
$Btn_Standard = GuiCtrlCreateButton("Standard", 75, 90, 90, 30)
$Btn_Extended = GuiCtrlCreateButton("Extended", 200, 90, 90, 30)
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
$current = Not $state
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Standard
_GUICtrlComboSetExtendedUI($Combo, 0)
Case $msg = $Btn_Extended
_GUICtrlComboSetExtendedUI($Combo, 1)
Case Else
$state = _GUICtrlComboGetExtendedUI($Combo)
If($state And $state <> $current) Then
$current = $state
GUICtrlSetData($Status,"Extend UI: True")
ElseIf($state <> $current) Then
$current = $state
GUICtrlSetData($Status,"Extend UI: False")
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboGetHorizontalExtent

Function Reference

_GUICtrlComboGetHorizontalExtent

Retrieve from a combo box the width, in pixels

#Include <GuiCombo.au3>
_GUICtrlComboGetHorizontalExtent($h_combobox)

Parameters

$h_combobox control id/control hWnd

Return Value

The return value is the scrollable width, in pixels.

Remarks

Retrieve from a combo box the width, in pixels, by which the
list box can be scrolled horizontally (the scrollable width).
This is applicable only if the list box has a horizontal scroll bar.

Related

_GuICtrlComboSetHorizontalExtent

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$Btn_Exit,$Status,$msg

GuiCreate("ComboBox Get Horizontal Extent", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 100, 150,BitOR($CBS_SIMPLE,$CBS_DISABLENOSCROLL,$WS_HSCROLL))
GUICtrlSetData($Combo,"AutoIt v3 is freeware BASIC-like scripting language designed for automating the Windows GUI.|" & _
"It uses a combination of simulated keystrokes mouse movement and window/control manipulation|" & _
"in order to automate tasks in a way not possible or reliable with other languages|" & _
"(e.g. VBScript and SendKeys).")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
_GuICtrlComboSetHorizontalExtent($Combo, 500)
GUICtrlSetData($Status,"Horizontal Extent: " & _GUICtrlComboGetHorizontalExtent($Combo))
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlComboGetItemHeight

Function Reference

_GUICtrlComboGetItemHeight

Determine the height of list items or the selection field in a combo box

#Include <GuiCombo.au3>
_GUICtrlComboGetItemHeight($h_combobox[, $i_index=-1])

Parameters

$h_combobox | control id/control hWnd
$i_index | Optional: Specifies the zero-based index of the string

Return Value

The return value is the height, in pixels, of the list items in a combo box.
If the combo box has the CBS_OWNERDRAWVARIABLE style, it is the height of the
item specified by the $i_index parameter. If $i_index is –1, the return value
is the height of the edit control (or static-text) portion of the combo box.
If an error occurs, the return value is $CB_ERR

Remarks

None.

Related

_GUICtrlComboSetItemHeight

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$Btn_Exit,$msg,$Status

GuiCreate("ComboBox Get Item Height", 392, 254)

$Combo = GuiCtrlCreateCombo("A", 70, 10, 270, 100,$CBS_SIMPLE)
GUICtrlSetData($Combo,"B|C|D|E|F")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
GUICtrlSetData($Status,"Item 1 Height " & _GUICtrlComboGetItemHeight($Combo, 1))

GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlComboGetLBText

Function Reference

_GUICtrlComboGetLBText

Retrieve a string from the list of a combo box.

#Include <GuiCombo.au3>
_GUICtrlComboGetLBText($h_combobox, $i_index, ByRef $s_text)

Parameters

$h_combobox | control id/control hWnd
$i_index | Specifies the zero-based index of the string to retrieve.
$s_text | Buffer that receives the string

Return Value

Success: | Returns is the length of the string in TCHARs, excluding the terminating null character.
Failure: | Returns $CB_ERR if $i_index does not specify a valid index.

Remarks

None.

Related

_GUICtrlComboGetLBTextLen

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

opt('MustDeclareVars', 1)

Dim $Combo, $Btn_Exit, $Status, $msg, $Btn_Get, $Input_item

GUICreate("ComboBox Get LB Text", 392, 254)

$Combo = GUICtrlCreateCombo("", 70, 10, 270, 120)
GUICtrlSetData($Combo, "AutoIt|v3|is|freeware|BASIC-like|scripting|language|designed|for|automating|the Windows GUI.")

GUICtrlCreateLabel("Enter index number of item:", 65, 112, 130, 20, $SS_RIGHT)
$Input_item = GUICtrlCreateInput("0", 200, 110, 50, 20, $ES_NUMBER)
GUICtrlSetLimit($Input_item, 2)

$Btn_Get = GUICtrlCreateButton("Get Text", 150, 140, 90, 30)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUICtrlSetData($Status, "Items: " & _GUICtrlComboGetCount ($Combo))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Get
Local $s_text
Local $i_count = _GUICtrlComboGetLBText ($Combo, Int(GUICtrlRead($Input_item)), $s_text)
If ($i_count == $CB_ERR) Then
GUICtrlSetData($Status, "Invalid Index: " & GUICtrlRead($Input_item))
Else
GUICtrlSetData($Status, "Len: " & $i_count & ", Index: " & GUICtrlRead($Input_item) & " = " & $s_text)
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboGetLBTextLen

Function Reference

_GUICtrlComboGetLBTextLen

Retrieve the length, in characters, of a string in the list of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboGetLBTextLen($h_combobox, $i_index)

Parameters

$h_combobox | control id/control hWnd
$i_index | Specifies the zero-based index of the string

Return Value

Success: | Returns is the length of the string, in TCHARs, excluding the terminating null character.
 | If an ANSI string this is the number of bytes, and if it is a Unicode string this is the number of characters.
Failure: | Returns $CB_ERR if the $i_index parameter does not specify a valid index.

Remarks

Under certain conditions, the return value is larger than the
actual length of the text. This occurs with certain mixtures of
ANSI and Unicode, and is due to the operating system allowing for
the possible existence of double-byte character set (DBCS) characters
within the text. The return value, however, will always be at least
as large as the actual length of the text; so you can always use it
to guide buffer allocation.

This behavior can occur when an application uses both ANSI functions
and common dialogs, which use Unicode.

To obtain the exact length of the text, use the WM_GETTEXT, LB_GETTEXT,
or CB_GETLBTEXT messages, or the GetWindowText function

Related

_GUICtrlComboSetEditSel

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$Btn_Exit,$Status,$msg

GuiCreate("ComboBox Get LB Text Len", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 100,$CBS_SIMPLE)
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Combo
If(_GUICtrlComboGetCurSel($Combo) <> $CB_ERR) Then
GUICtrlSetData($Status,"Length of Item[" & _GUICtrlComboGetCurSel($Combo) & "] = " & _GUICtrlComboGetLBTextLen($Combo, _GUICtrlComboGetCurSel($Combo)))
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboGetList

Function Reference

_GUICtrlComboGetList

Retrieves all items from the list portion of a ComboBox control.

#include <GUICombo.au3>
_GUICtrlComboGetList ( $idCombo [, $sDelimiter = "|" ] )

Parameters

$idCombo | Control ID of the combo.
$sDelimiter | Delimeter used to seperate each item (Defaults to |).

Return Value

Delimited string of all ComboBox items.

Remarks

None.

Related

_GUICtrlComboGetLBText

Example

#include <GUIConstants.au3>
#include <GUICombo.au3>

GUICreate("My GUI combo")

Global $g_idCombo = GUICtrlCreateCombo ("", 10, 10, 100, 120)
GUICtrlSetData($g_idCombo, "item1|item1")

GUISetState ()

While 1
If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
Wend

MsgBox(4096, "", _GUICtrlComboGetList($g_idCombo))


Function _GUICtrlComboGetLocale

Function Reference

_GUICtrlComboGetLocale

Retrieve the current locale of the combo box

#Include <GuiCombo.au3>
_GUICtrlComboGetLocale($h_combobox)

Parameters

$h_combobox control id/control hWnd

Return Value

Returns the current Local of the combobox
same as @OSLang unless changed

Remarks

"0409" for U.S. English
see @OSLang for string values

Related

None.

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$Btn_Exit,$Status,$msg

GuiCreate("ComboBox Get Locale", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 100,$CBS_SIMPLE)
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
GUICtrlSetData($Status,"Locale: " & _GUICtrlComboGetLocale($Combo))
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlComboGetMinVisible

Function Reference

_GUICtrlComboGetMinVisible

Get the minimum number of visible items in the drop-down list of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboGetMinVisible($h_combobox)

Parameters

$h_combobox control id/control hWnd

Return Value

The return value is the minimum number of visible items

Remarks

When the number of items in the drop-down list is greater
than the minimum, the combo box uses a scrollbar.

This message is ignored if the combo box control has style
$CBS_NOINTEGRALHEIGHT.

To use $CB_GETMINVISIBLE, the application must specify comctl32.dll
version 6 in the manifest. For more information, see
Using Windows XP Visual Styles

Related

_GUICtrlComboSetMinVisible

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$Btn_Exit,$Status,$msg

GuiCreate("ComboBox Get Min Visible", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 100,$CBS_SIMPLE)
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
GUICtrlSetData($Status,"Min Visible: " & _GUICtrlComboGetMinVisible($Combo))
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlComboGetTopIndex

Function Reference

_GUICtrlComboGetTopIndex

Retrieve the zero-based index of the first visible item in the list box portion of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboGetTopIndex($h_combobox)

Parameters

$h_combobox control id/control hWnd

Return Value

Success: | Returns is the index of the first visible item in the list box of the combo box.
Failure: | Returns $CB_ERR if the message fails.

Remarks

Initially, the item with index 0 is at the top of the list box,
but if the list box contents have been scrolled, another item may be at the top

Related

_GUICtrlComboSetTopIndex

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$Btn_Exit,$Status,$msg,$Btn_Get

GuiCreate("ComboBox Get Top Index", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 100,BitOR($CBS_SIMPLE,$CBS_DISABLENOSCROLL,$WS_VSCROLL))
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language|designed|for|automating")
$Btn_Get = GuiCtrlCreateButton("Get Top Index", 150, 140, 90, 30)
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
GUICtrlSetData($Status,"Top Index: " & _GUICtrlComboGetTopIndex($Combo))
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Get
GUICtrlSetData($Status,"Top Index: " & _GUICtrlComboGetTopIndex($Combo))
EndSelect
WEnd
Exit


Function _GUICtrlComboInitStorage

Function Reference

_GUICtrlComboInitStorage

Allocates memory for storing list box portion of the combo box items

#Include <GuiCombo.au3>
_GUICtrlComboInitStorage($h_combobox, $i_num, $i_bytes)

Parameters

$h_combobox | control id/control hWnd
$i_num | Specifies the number of items to add
$i_bytes | Specifies the amount of memory to allocate for item strings, in bytes

Return Value

Success: | Returns is the total number
Failure: | Returns $CB_ERRSPACE if the message fails.

Remarks

Windows NT 4.0: This message does not allocate the specified amount of memory
however, it always returns the value specified in the $i_num parameter.

Windows 2000/XP: The message allocates memory and returns the success and error values described above

The $CB_INITSTORAGE message helps speed up the initialization of combo boxes
that have a large number of items (over 100).

It reserves the specified amount of memory so that subsequent $CB_ADDSTRING,
$CB_INSERTSTRING, and $CB_DIR messages take the shortest possible time.

You can use estimates for the $i_num and $i_bytes parameters.

If you overestimate, the extra memory is allocated, if you underestimate,
the normal allocation is used for items that exceed the requested amount

Related

_GUICtrlComboAddDir

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$ret,$Btn_Exit,$Status,$msg,$allocated

GuiCreate("ComboBox Init Storage", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 100,$CBS_SIMPLE)
$allocated = _GUICtrlComboInitStorage($Combo, 26, 50)
$ret = _GUICtrlComboAddDir($Combo,"drives")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
GUICtrlSetData($Status,"Pre-Allocated Memory For: " & $allocated & " Items, Drives Added To ComboBox: " & _GUICtrlComboGetCount($Combo))
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlComboInsertString

Function Reference

_GUICtrlComboInsertString

Insert a string into the list box of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboInsertString($h_combobox, $i_index , $s_text)

Parameters

$h_combobox | control id/control hWnd
$i_index | Specifies the zero-based index of the position at which to insert the string
$s_text | String to insert

Return Value

Success: | Return the index of the position at which the string was inserted.
Failure: | Returns $CB_ERR if an error occurs.
 | Returns $CB_ERRSPACE if there is insufficient space to store the new strings.

Remarks

If the $i_index parameter is –1, the string is added to the end of the list.

If the combo box has $WS_HSCROLL style and you insert a string wider than the
combo box, you should send a LB_SETHORIZONTALEXTENT message to ensure the
horizontal scrollbar appears

Related

_GUICtrlComboAddString, _GUICtrlComboDeleteString, _GUICtrlComboResetContent

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Label,$Input,$Btn_Insert,$Combo,$Btn_Exit,$msg,$Status,$i_index

GuiCreate("ComboBox Insert String", 392, 254)

$Label = GuiCtrlCreateLabel("Enter String to Insert", 20, 20, 120, 20)
$Input = GuiCtrlCreateInput("", 160, 20, 180, 20)
$Btn_Insert = GuiCtrlCreateButton("Add String", 210, 50, 90, 30)
$Combo = GuiCtrlCreateCombo("A", 70, 100, 270, 100,$CBS_SIMPLE)
GUICtrlSetData($Combo,"B|C|D|E|F")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 200, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))

GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Insert
If(StringLen(GUICtrlRead($Input)) > 0) Then
$i_index =_GUICtrlComboInsertString($Combo,_GUICtrlComboGetCurSel($Combo),GUICtrlRead($Input))
GUICtrlSetData($Status,"String Inserted At Index: " & $i_index)
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboLimitText

Function Reference

_GUICtrlComboLimitText

Limit the length of the text the user may type into the edit control of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboLimitText($h_combobox[, $i_limit=0])

Parameters

$h_combobox | control id/control hWnd
$i_limit | Optional: Specifies the maximum number of characters the user can enter

Return Value

None.

Remarks

If the $i_limit parameter is zero, the text length is limited to 0x7FFFFFFE characters.

If the combo box does not have the $CBS_AUTOHSCROLL style, setting the text limit to
be larger than the size of the edit control has no effect.

The $CB_LIMITTEXT message limits only the text the user can enter.

It has no effect on any text already in the edit control when the message is sent,
nor does it affect the length of the text copied to the edit control when a string
in the list box is selected.

The default limit to the text a user can enter in the edit control is 30,000 characters

Related

None.

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$Btn_Exit,$msg

GuiCreate("ComboBox Limit Text", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 100, 270, 100,$CBS_SIMPLE)
GUICtrlSetData($Combo,"A|B|C|D|E|F")
_GUICtrlComboLimitText($Combo,10)
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 200, 90, 30)

GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlComboResetContent

Function Reference

_GUICtrlComboResetContent

Remove all items from the list box and edit control of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboResetContent($h_combobox)

Parameters

$h_combobox control id/control hWnd

Return Value

None.

Remarks

None.

Related

_GUICtrlComboAddString, _GUICtrlComboDeleteString, _GUICtrlComboInsertString

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$ret,$Btn_Exit,$msg,$allocated,$Btn_Clear

GuiCreate("ComboBox Reset Content", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 100,$CBS_SIMPLE)
$allocated = _GUICtrlComboInitStorage($Combo, 26, 50)
$ret = _GUICtrlComboAddDir($Combo,"drives")
$Btn_Clear = GUICtrlCreateButton("Reset Content",150,140,90,30)
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Clear
_GUICtrlComboResetContent($Combo)
EndSelect
WEnd
Exit


Function _GUICtrlComboSelectString

Function Reference

_GUICtrlComboSelectString

Search the list of a combo box for an item that begins with the characters in a specified string

#Include <GuiCombo.au3>
_GUICtrlComboSelectString($h_combobox,$i_index,$s_search)

Parameters

$h_combobox | control id/control hWnd
$i_index | Specifies the zero-based index of the item preceding the first item to be searched
$s_search | string that contains the characters for which to search

Return Value

Success: | Returns the index of the selected item.
Failure: | Returns $CB_ERR if the search is unsuccessful and the current selection is not changed.

Remarks

When the search reaches the bottom of the list, it continues from the top
of the list back to the item specified by the wParam parameter.

If $i_index is –1, the entire list is searched from the beginning

A string is selected only if the characters from the starting point
match the characters in the prefix string

Related

_GUICtrlComboFindString

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Label,$Input,$Btn_Search,$Combo,$Btn_Exit,$Status,$msg,$ret

GuiCreate("ComboBox Select String", 392, 254)

$Label = GuiCtrlCreateLabel("Enter Search String", 20, 20, 120, 20)
$Input = GuiCtrlCreateInput("", 160, 20, 180, 20)
$Btn_Search = GuiCtrlCreateButton("Search", 160, 50, 90, 30)
$Combo = GuiCtrlCreateCombo("", 70, 100, 270, 100,$CBS_SIMPLE)
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 200, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Search
If(StringLen(GUICtrlRead($Input)) > 0) Then
$ret = _GUICtrlComboSelectString($Combo,-1,GUICtrlRead($Input))
If($ret <> $CB_ERR) Then
GUICtrlSetData($Status,'Found "' & GUICtrlRead($Input) & '" at index: ' & $ret)
Else
GUICtrlSetData($Status,'"' & GUICtrlRead($Input) & '" Not Found')
EndIf
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboSetCurSel

Function Reference

_GUICtrlComboSetCurSel

Select a string in the list of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboSetCurSel($h_combobox,$i_index)

Parameters

$h_combobox | control id/control hWnd
$i_index | Specifies the zero-based index of the string to select

Return Value

Success: | Returns the index of the item selected.
Failure: | Returns $CB_ERR if $i_index is greater than the number of items in the list or if $i_index is –1 and the selection is cleared.
 | Returns $CB_ERRSPACE if there is insufficient space to store the new strings.

Remarks

If this $i_index is –1, any current selection in the list is removed and the edit control is cleared

Related

_GUICtrlComboGetCurSel

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Label,$Input,$Btn_Set,$Combo,$Btn_Exit,$msg,$ret

GuiCreate("ComboBox Set Cur Sel", 392, 254)

$Label = GuiCtrlCreateLabel("Enter Index to Set", 20, 20, 120, 20)
$Input = GuiCtrlCreateInput("", 160, 20, 180, 20,$ES_NUMBER)
GUICtrlSetLimit($Input,1)
$Btn_Set = GuiCtrlCreateButton("Set Cur Sel", 160, 50, 90, 30)
$Combo = GuiCtrlCreateCombo("", 70, 100, 270, 100,$CBS_SIMPLE)
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 200, 90, 30)
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Set
If(StringLen(GUICtrlRead($Input)) > 0) Then
$ret = _GUICtrlComboSetCurSel($Combo,Int(GUICtrlRead($Input)))
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboSetDroppedWidth

Function Reference

_GUICtrlComboSetDroppedWidth

Set the maximum allowable width

#Include <GuiCombo.au3>
_GUICtrlComboSetDroppedWidth($h_combobox, $i_width)

Parameters

$h_combobox | control id/control hWnd
$i_width | Specifies the width of the list box, in pixels

Return Value

Success: | Returns the new width of the list box.
Failure: | Returns $CB_ERR.

Remarks

Requirement: CBS_DROPDOWN or CBS_DROPDOWNLIST style

Related

_GUICtrlComboGetDroppedWidth, _GUICtrlComboGetDroppedState

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Label,$Input,$Btn_Set,$Combo,$Btn_Exit,$msg,$ret

GuiCreate("ComboBox Set Dropped Width", 392, 254)

$Label = GuiCtrlCreateLabel("Enter New Width", 20, 20, 100, 20)
$Input = GuiCtrlCreateInput("", 160, 20, 180, 20,$ES_NUMBER)
GUICtrlSetLimit($Input,3)
$Btn_Set = GuiCtrlCreateButton("Set Width", 160, 50, 90, 30)
$Combo = GuiCtrlCreateCombo("", 70, 100, 50, 120)
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 200, 90, 30)
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Set
If(StringLen(GUICtrlRead($Input)) > 0) Then
$ret = _GUICtrlComboSetDroppedWidth($Combo,Int(GUICtrlRead($Input)))
If($ret == $CB_ERR) Then
MsgBox(0,"Error","Couldn't set width")
EndIf
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboSetEditSel

Function Reference

_GUICtrlComboSetEditSel

Select characters in the edit control of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboSetEditSel($h_combobox, $i_start, $i_stop)

Parameters

$h_combobox | control id/control hWnd
$i_start | starting position
$i_stop | ending position

Return Value

Success: | Returns TRUE.
Failure: | Returns $CB_ERR if the message is sent to a combo box with the $CBS_DROPDOWNLIST style.
 | Returns $CB_ERRSPACE if there is insufficient space to store the new strings.

Remarks

The positions are zero-based.

The first character of the edit control is in the zero position.

The first character after the last selected character is in the ending position.

For example, to select the first four characters of the edit control,
use a starting position of 0 and an ending position of 4

Related

_GUICtrlComboGetLBTextLen

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$Btn_Exit,$msg,$Btn_Sel

GuiCreate("ComboBox Set Edit Sel", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 100,$CBS_SIMPLE)
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language","freeware")
$Btn_Sel = GUICtrlCreateButton("Select 1st 4 chars",150,150,90,30)
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 200, 90, 30)

GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Sel
_GUICtrlComboSetEditSel($Combo,0,4)
EndSelect
WEnd
Exit


Function _GUICtrlComboSetExtendedUI

Function Reference

_GUICtrlComboSetExtendedUI

Select either the default user interface or the extended user interface

#Include <GuiCombo.au3>
_GUICtrlComboSetExtendedUI($h_combobox, $i_bool)

Parameters

$h_combobox | control id/control hWnd
$i_bool | Specifies whether the combo box uses the extended user interface or the default user interface

Return Value

Success: | Returns $CB_OKAY.
Failure: | Returns $CB_ERR if an error occurs.

Remarks

By default, the F4 key opens or closes the list and the
DOWN ARROW changes the current selection. In the extended
user interface, the F4 key is disabled and the DOWN ARROW
key opens the drop-down list

$i_bool specifies whether the combo box uses the extended
user interface or the default user interface.

A value of TRUE selects the extended user interface

A value of FALSE selects the standard user interface

Related

_GUICtrlComboGetExtendedUI

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$Btn_Exit,$Status,$msg,$Btn_Standard,$Btn_Extended,$state,$current

GuiCreate("ComboBox Set Extended UI", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 120)
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language")
$Btn_Standard = GuiCtrlCreateButton("Standard", 75, 90, 90, 30)
$Btn_Extended = GuiCtrlCreateButton("Extended", 200, 90, 90, 30)
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
$current = Not $state
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Standard
_GUICtrlComboSetExtendedUI($Combo, 0)
Case $msg = $Btn_Extended
_GUICtrlComboSetExtendedUI($Combo, 1)
Case Else
$state = _GUICtrlComboGetExtendedUI($Combo)
If($state And $state <> $current) Then
$current = $state
GUICtrlSetData($Status,"Extend UI: True")
ElseIf($state <> $current) Then
$current = $state
GUICtrlSetData($Status,"Extend UI: False")
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboSetHorizontalExtent

Function Reference

_GUICtrlComboSetHorizontalExtent

Set the width, in pixels

#Include <GuiCombo.au3>
_GUICtrlComboSetHorizontalExtent($h_combobox, $i_width)

Parameters

$h_combobox | control id/control hWnd
$i_width | Specifies the scrollable width of the list box, in pixels

Return Value

None.

Remarks

An application sends the $CB_SETHORIZONTALEXTENT message to set the width,
in pixels, by which a list box can be scrolled horizontally (the scrollable width).

If the width of the list box is smaller than this value, the horizontal scroll bar
horizontally scrolls items in the list box.

If the width of the list box is equal to or greater than this value, the horizontal
scroll bar is hidden or, if the combo box has the $CBS_DISABLENOSCROLL style, disabled.

Related

_GUICtrlComboGetHorizontalExtent

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$Btn_Exit,$Status,$msg

GuiCreate("ComboBox Set Horizontal Extent", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 100, 150,BitOR($CBS_SIMPLE,$CBS_DISABLENOSCROLL,$WS_HSCROLL))
GUICtrlSetData($Combo,"AutoIt v3 is freeware BASIC-like scripting language designed for automating the Windows GUI.|" & _
"It uses a combination of simulated keystrokes mouse movement and window/control manipulation|" & _
"in order to automate tasks in a way not possible or reliable with other languages|" & _
"(e.g. VBScript and SendKeys).")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
_GUICtrlComboSetHorizontalExtent($Combo, 500)
GUICtrlSetData($Status,"Horizontal Extent: " & _GUICtrlComboGetHorizontalExtent($Combo))
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlComboSetItemHeight

Function Reference

_GUICtrlComboSetItemHeight

Set the height of list items or the selection field in a combo box

#Include <GuiCombo.au3>
_GUICtrlComboSetItemHeight($h_combobox, $i_component, $i_height)

Parameters

$h_combobox | control id/control hWnd
$i_component | Specifies the component of the combo box for which to set the height
$i_height | Specifies the height, in pixels, of the combo box component identified by $i_component

Return Value

Success: | Returns $CB_OKAY.
Failure: | Returns $CB_ERR if the index or height is invalid.

Remarks

$i_component parameter must be –1 to set the height of the selection field.

It must be zero to set the height of list items, unless the combo box has
the CBS_OWNERDRAWVARIABLE style. In that case, the $i_component parameter
is the zero-based index of a specific list item

Related

_GUICtrlComboGetItemHeight

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt ('MustDeclareVars', 1)

Dim $Height = 25, $Btn_Set, $Combo, $Btn_Exit, $msg, $ret

GUICreate("ComboBox Set Item Height", 392, 254)

$Combo = GUICtrlCreateCombo("", 70, 10, 270, 120)
GUICtrlSetData($Combo, "AutoIt|v3|is|freeware|BASIC-like|scripting|language")
$Btn_Set = GUICtrlCreateButton("Set", 150, 140, 90, 30)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 180, 90, 30)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Set
$ret = _GUICtrlComboSetItemHeight ($Combo, -1, $Height)
If ($Height == 25) Then
$Height = 15
Else
$Height = 25
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboSetMinVisible

Function Reference

_GUICtrlComboSetMinVisible

Set the minimum number of visible items in the drop-down list of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboSetMinVisible($h_combobox, $i_minimum)

Parameters

$h_combobox | control id/control hWnd
$i_minimum | Specifies the minimum number of visible items

Return Value

Success: | Returns TRUE.
Failure: | Returns FALSE otherwise.

Remarks

When the number of items in the drop-down list is greater than the minimum,
the combo box uses a scrollbar.

By default, 30 is the minimum number of visible items.

This message is ignored if the combo box control has style $CBS_NOINTEGRALHEIGHT.

To use $CB_SETMINVISIBLE, the application must specify comctl32.dll version 6 in the manifest

Related

_GUICtrlComboGetMinVisible

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt ('MustDeclareVars', 1)

Dim $Min = 5, $Combo, $ret, $Btn_Exit, $msg, $ret, $Btn_Set

GUICreate("ComboBox Set Min Visible", 392, 254)

$Combo = GUICtrlCreateCombo("", 70, 10, 270, 120)
$ret = _GUICtrlComboAddDir ($Combo, "drives")
$Btn_Set = GUICtrlCreateButton("Set", 150, 160, 90, 30)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 200, 90, 30)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Set
_GUICtrlComboSetMinVisible ($Combo, $Min)
If ($Min == 5) Then
$Min = 30
Else
$Min = 5
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboSetTopIndex

Function Reference

_GUICtrlComboSetTopIndex

Ensure that a particular item is visible

#Include <GuiCombo.au3>
_GUICtrlComboSetTopIndex($h_combobox, $i_index)

Parameters

$h_combobox | control id/control hWnd
$i_index | Specifies the zero-based index of the list item

Return Value

Success: | Returns 0.
Failure: | Returns $CB_ERR.

Remarks

The system scrolls the list box contents so that either the specified
item appears at the top of the list box or the maximum scroll range
has been reached

Related

_GUICtrlComboGetTopIndex

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$ret,$Btn_Exit,$msg,$ret,$Label,$Input,$Btn_Set

GuiCreate("ComboBox Set Top Index", 392, 254)

$Label = GuiCtrlCreateLabel("Enter Top Index", 80, 20, 120, 20)
$Input = GuiCtrlCreateInput("", 160, 20, 50, 20,$ES_NUMBER)
GUICtrlSetLimit($Input,2)
$Btn_Set = GuiCtrlCreateButton("Set", 160, 50, 90, 30)
$Combo = GuiCtrlCreateCombo("", 70, 100, 270, 80,BitOR($CBS_SIMPLE,$CBS_DISABLENOSCROLL,$WS_VSCROLL))
$ret = _GUICtrlComboAddDir($Combo,"drives")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 200, 90, 30)
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Set
If(StringLen(GUICtrlRead($Input)) > 0) Then
_GUICtrlComboSetTopIndex($Combo,Int(GUICtrlRead($Input)))
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlComboShowDropDown

Function Reference

_GUICtrlComboShowDropDown

Show or hide the list box of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboShowDropDown($h_combobox, $i_bool)

Parameters

$h_combobox | control id/control hWnd
$i_bool | Specifies whether the drop-down list box is to be shown or hidden

Return Value

None.

Remarks

Requirement: $CBS_DROPDOWN or $CBS_DROPDOWNLIST style

$i_bool = TRUE shows the list box
$i_bool = FALSE hides it

This message has no effect on a combo box created with the $CBS_SIMPLE style

Related

_GUICtrlComboGetDroppedState, _GUICtrlComboGetDroppedWidth, _GUICtrlComboSetDroppedWidth

Example

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Label,$Input,$Btn_Show,$Btn_Hide,$Combo,$Btn_Exit,$msg,$ret

GuiCreate("ComboBox Show Dropdown", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 120)
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language")
$Btn_Show = GuiCtrlCreateButton("Show", 80, 140, 90, 30)
$Btn_Hide = GuiCtrlCreateButton("Hide", 220, 140, 90, 30)
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Show
_GUICtrlComboShowDropDown($Combo,1)
Case $msg = $Btn_Hide
_GUICtrlComboShowDropDown($Combo,0)
EndSelect
WEnd
Exit


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: GuiEdit Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_GUICtrlEditCanUndo | Determines whether there are any actions in an edit control's undo queue.
_GUICtrlEditEmptyUndoBuffer | Resets the undo flag of an edit control.
_GUICtrlEditFind | Find/Replace text in an Edit control
_GUICtrlEditGetFirstVisibleLine | Retrieves the zero-based index of the uppermost visible line in a multiline edit control.
_GUICtrlEditGetLineCount | Retrieves the number of lines in a multiline edit control.
_GUICtrlEditGetModify | Retrieves the state of an edit control's modification flag.
_GUICtrlEditGetRECT | Retrieves the formatting rectangle of an edit control.
_GUICtrlEditGetSel | Retrieves the starting and ending character positions of the current selection in an edit control.
_GUICtrlEditLineFromChar | Retrieves the index of the line that contains the specified character index in a multiline edit control.
_GUICtrlEditLineIndex | Retrieves the character index of the first character of a specified line in a multiline edit control.
_GUICtrlEditLineLength | Retrieves the length, in characters, of a line in an edit control.
_GUICtrlEditLineScroll | Scrolls the text in a multiline edit control.
_GUICtrlEditReplaceSel | Replaces the current selection in an edit control with the specified text.
_GUICtrlEditScroll | Scrolls the text vertically in a multiline edit control.
_GUICtrlEditSetModify | Sets or clears the modification flag for an edit control.
_GUICtrlEditSetRECT | Sets the formatting rectangle of an edit control.
_GUICtrlEditSetSel | Selects a range of characters in an edit control.
_GUICtrlEditUndo | Undoes the last edit control operation in the control's undo queue.


Function _GUICtrlEditCanUndo

Function Reference

_GUICtrlEditCanUndo

Determines whether there are any actions in an edit control's undo queue.

#Include <GuiEdit.au3>
_GUICtrlEditCanUndo($h_edit)

Parameters

$h_edit control id/control hWnd

Return Value

Success: | Returns nonzero, if there are actions in the control's undo queue.
Failure: | Returns zero, if the undo queue is empty.

Remarks

If the undo queue is not empty, you can call the _GUICtrlEditUndo
to undo the most recent operation.

Related

_GUICtrlEditEmptyUndoBuffer, _GUICtrlEditGetModify, _GUICtrlEditReplaceSel, _GUICtrlEditSetModify, _GUICtrlEditUndo

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $ret, $Status, $msg, $current

GUICreate("Edit Can Undo", 392, 254)

$myedit = GUICtrlCreateEdit("First line" & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)

$Status = GUICtrlCreateLabel("Nothing to Undo", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
$ret = _GUICtrlEditCanUndo ($myedit)
If ($ret <> $current) Then
If ($ret == 0) Then
GUICtrlSetData($Status, "Nothing to Undo")
Else
GUICtrlSetData($Status, "Undo Available")
EndIf
$current = $ret
EndIf
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd


Function _GUICtrlEditEmptyUndoBuffer

Function Reference

_GUICtrlEditEmptyUndoBuffer

Resets the undo flag of an edit control.

#Include <GuiEdit.au3>
_GUICtrlEditEmptyUndoBuffer($h_edit)

Parameters

$h_edit control id/control hWnd

Return Value

None.

Remarks

The undo flag is automatically reset whenever the edit control receives a WM_SETTEXT or EM_SETHANDLE message.
The control can only undo or redo the most recent operation.

Related

_GUICtrlEditCanUndo, _GUICtrlEditGetModify, _GUICtrlEditReplaceSel, _GUICtrlEditSetModify, _GUICtrlEditUndo

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $ret, $Status, $msg, $current, $Btn_Empty

GUICreate("Edit Empty Undo Buffer", 392, 254)

$myedit = GUICtrlCreateEdit("First line" & @CRLF, 140, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)
$Btn_Empty = GUICtrlCreateButton("Emtpy Buffer", 150, 150)
$Status = GUICtrlCreateLabel("Nothing to Undo", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
$ret = _GUICtrlEditCanUndo ($myedit)
If ($ret <> $current) Then
If ($ret == 0) Then
GUICtrlSetData($Status, "Nothing to Undo")
Else
GUICtrlSetData($Status, "Undo Available")
EndIf
$current = $ret
EndIf
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Btn_Empty
_GUICtrlEditEmptyUndoBuffer ($myedit)
EndSelect
WEnd


Function _GUICtrlEditFind

Function Reference

_GUICtrlEditFind

Find/Replace text in an Edit control

#Include <GuiEdit.au3>
_GUICtrlEditFind(ByRef $h_gui, ByRef $h_edit[, $b_replace = False[, $s_WinTitle = ""[, $s_WinText = ""]]])

Parameters

h_gui | GUI ID/Window Handle (Handle only be used with external controls)
$h_edit | control ID/Control Handle (Handle only be used with external controls)
$b_replace | Optional: Boolean True/False show replace option (Default is False)
$s_WinTitle | Optional: Window Title (should only be used with external controls)
$s_WinText | Optional: Window Text (should only be used with external controls)

Return Value

Remarks

Be careful using the $s_WinText
If you use text from the edit control and that text gets replaced
the function will no longer function correctly

Related

_GUICtrlEditReplaceSel, _GUICtrlEditGetSel, _GUICtrlEditSetSel

Example

Opt("MustDeclareVars", 1)
#include <GUIConstants.au3>
#include <GuiEdit.au3>

; *******************************************************
; Example 1 - Using with an AutoIt Created Edit control
; *******************************************************

_UseAutoItControl()

Func _UseAutoItControl()
Local $s_texttest = "this is a test" & @CRLF & _
"this is only a test" & @CRLF & _
"this testing should work for you as well as it does for me"
Local $GuiCtrlEditSearch, $myEdit, $Button1, $Button2, $msg

$GuiCtrlEditSearch = GUICreate('Find And Replace Example with AutoIt ' & FileGetVersion(@AutoItExe), 622, 448, 192, 125)
$myEdit = GUICtrlCreateEdit($s_texttest, 64, 24, 505, 233, _
BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE, $WS_HSCROLL, $ES_NOHIDESEL))
$Button1 = GUICtrlCreateButton("Find", 176, 288, 121, 33, 0)
$Button2 = GUICtrlCreateButton("Find And Replace", 368, 288, 121, 33, 0)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button1
_GUICtrlEditFind ($GuiCtrlEditSearch, $myEdit)
Case $msg = $Button2
_GUICtrlEditFind ($GuiCtrlEditSearch, $myEdit, True)
Case Else
;;;;;;;
EndSelect
WEnd
GUIDelete()
EndFunc ;==>_UseAutoItControl

; *******************************************************
; Example 2 - Using with an external Edit control
; *******************************************************

_UseExternalControl()

Func _UseExternalControl()
Local $s_texttest = 'Find And Replace Example with AutoIt ' & FileGetVersion(@AutoItExe) & @LF & _
"this is a test" & @LF & _
"this is only a test" & @LF & _
"this testing should work for you as well as it does for me"
Local $whandle, $handle
Local $Title = "Untitled - Notepad"

Run("notepad", "", @SW_MAXIMIZE)
;Wait for the window "Untitled" to exist
WinWait($Title)

; Get the handle of a notepad window
$whandle = WinGetHandle($Title)
If @error Then
MsgBox(4096, "Error", "Could not find the correct window")
Else
$handle = ControlGetHandle($whandle, "", "Edit1")
If @error Then
MsgBox(4096, "Error", "Could not find the correct control")
Else
; Send some text directly to this window's edit control
ControlSend($whandle, "", "Edit1", $s_texttest)
_GUICtrlEditFind ($whandle, $handle, True, $Title)
EndIf
EndIf
EndFunc ;==>_UseExternalControl


Function _GUICtrlEditGetFirstVisibleLine

Function Reference

_GUICtrlEditGetFirstVisibleLine

Retrieves the zero-based index of the uppermost visible line in a multiline edit control.

#Include <GuiEdit.au3>
_GUICtrlEditGetFirstVisibleLine($h_edit)

Parameters

$h_edit control id/control hWnd

Return Value

The return value is the zero-based index of the uppermost visible line in a multiline edit control.
For single-line edit controls, the return value is the zero-based index of the first visible character.

Remarks

The number of lines and the length of the lines in an edit control
depend on the width of the control and the current Wordwrap setting.

Related

_GUICtrlEditLineFromChar, _GUICtrlEditLineIndex, _GUICtrlEditLineScroll, _GUICtrlEditScroll

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $Status, $msg, $Btn_get

GUICreate("Edit Get First Visible Line", 392, 254)

$myedit = GUICtrlCreateEdit("First line" & @CRLF, 140, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)
$Btn_get = GUICtrlCreateButton("Get", 150, 150)
$Status = GUICtrlCreateLabel("", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

; will be append dont' forget 3rd parameter
GUICtrlSetData($myedit, "2nd line" & @CRLF & "3rd line" & @CRLF & "4th line" & @CRLF & _
"5th line" & @CRLF & "6th line" & @CRLF & "7th line" & @CRLF & "8th line" & @CRLF & "9th line", 1)

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Btn_get
GUICtrlSetData($Status, "First Visible Line: " & _GUICtrlEditGetFirstVisibleLine ($myedit))
EndSelect
WEnd


Function _GUICtrlEditGetLineCount

Function Reference

_GUICtrlEditGetLineCount

Retrieves the number of lines in a multiline edit control.

#Include <GuiEdit.au3>
_GUICtrlEditGetLineCount($h_edit)

Parameters

$h_edit control id/control hWnd

Return Value

The return value is an integer specifying the total number of text lines in the multiline edit control.

Remarks

If the control has no text, the return value is 1.
The return value will never be less than 1.

The _GUICtrlEditGetLineCount retrieves the total number of text lines,
not just the number of lines that are currently visible.

If the Wordwrap feature is enabled, the number of lines can change when the dimensions of the editing window change.

Related

_GUICtrlEditGetFirstVisibleLine, _GUICtrlEditLineFromChar, _GUICtrlEditLineIndex

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $Status, $msg

GUICreate("Edit Get Line Count", 392, 254)

$myedit = GUICtrlCreateEdit("First line" & @CRLF, 140, 32, 121, 97, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE))
GUICtrlSetLimit($myedit, 1500)
$Status = GUICtrlCreateLabel("", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

; will be append dont' forget 3rd parameter
GUICtrlSetData($myedit, "2nd line" & @CRLF & "3rd line" & @CRLF & "4th line" & @CRLF & _
"5th line" & @CRLF & "6th line" & @CRLF & "7th line" & @CRLF & "8th line" & @CRLF & "9th line", 1)

GUISetState()
GUICtrlSetData($Status, "Line Count: " & _GUICtrlEditGetLineCount ($myedit))

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlEditGetModify

Function Reference

_GUICtrlEditGetModify

Retrieves the state of an edit control's modification flag.

#Include <GuiEdit.au3>
_GUICtrlEditGetModify($h_edit)

Parameters

$h_edit control id/control hWnd

Return Value

Success: | Returns nonzero, if the contents of edit control have been modified.
Failure: | Returns 0 otherwise.

Remarks

The system automatically clears the modification flag to zero when the control is created.
If the user changes the control's text, the system sets the flag to nonzero.
You can call _GUICtrlEditSetModify to set or clear the flag.

Related

_GUICtrlEditCanUndo, _GUICtrlEditEmptyUndoBuffer, _GUICtrlEditSetModify, _GUICtrlEditUndo

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $ret, $Status, $msg, $current

GUICreate("Edit Get Modify", 392, 254)

$myedit = GUICtrlCreateEdit("First line" & @CRLF, 140, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)

$Status = GUICtrlCreateLabel("Un-Modified", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
$ret = _GUICtrlEditGetModify ($myedit)
If ($ret <> $current) Then
If ($ret == 0) Then
GUICtrlSetData($Status, "Un-Modified")
Else
GUICtrlSetData($Status, "Modified")
EndIf
$current = $ret
EndIf
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd


Function _GUICtrlEditGetRECT

Function Reference

_GUICtrlEditGetRECT

Retrieves the formatting rectangle of an edit control.

#Include <GuiEdit.au3>
_GUICtrlEditGetRECT($h_edit)

Parameters

$h_edit controlID

Return Value

Success: | Returns an array containing the RECT, first element ($array[0]) contains the number of elements.
Failure: | Returns $EC_ERR, if an error occurs.

Remarks

Under certain conditions, _GUICtrlEditGetRECT might not return the exact values that
_GUICtrlEditSetRECT set—it will be approximately correct,
but it can be off by a few pixels.

Related

_GUICtrlEditSetRECT

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $s_rect, $label_rect, $msg, $rect_array

GUICreate("Edit Get RECT", 392, 254)

$myedit = GUICtrlCreateEdit("First line" & @CRLF, 10, 32, 121, 97, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL))

$s_rect = "Left:" & @LF & "Top:" & @LF & "Right:" & @LF & "Bottom:"
$label_rect = GUICtrlCreateLabel($s_rect, 145, 50, 100, 55, $SS_SUNKEN)

GUISetState()
$rect_array = _GUICtrlEditGetRECT ($myedit)
If ($rect_array == $EC_ERR) Then
MsgBox(0, "Error", "Unable to Get RECT")
ElseIf (IsArray($rect_array)) Then
$s_rect = "Left:" & $rect_array[1] & @LF & "Top:" & $rect_array[2] & @LF & "Right:" & $rect_array[3] & @LF & "Bottom:" & $rect_array[4]
GUICtrlSetData($label_rect, $s_rect)
EndIf

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlEditGetSel

Function Reference

_GUICtrlEditGetSel

Retrieves the starting and ending character positions of the current selection in an edit control.

#Include <GuiEdit.au3>
_GUICtrlEditGetSel($h_edit)

Parameters

$h_edit control id/control hWnd

Return Value

Success: | Returns an array containing the starting and ending selected positions, first element ($array[0]) contains the number of elements.
Failure: | Returns $EC_ERR if an error occurs.

Remarks

$array[1] contains the starting position
$array[2] contains the ending position

Related

_GUICtrlEditReplaceSel, _GUICtrlEditSetSel

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $Status, $msg, $Btn_GET, $a_sel

GUICreate("Edit Get Line Count", 392, 254)

$myedit = GUICtrlCreateEdit("First line" & @CRLF, 140, 32, 121, 97, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE))
GUICtrlSetLimit($myedit, 1500)
$Status = GUICtrlCreateLabel("", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
$Btn_GET = GUICtrlCreateButton("Get Sel", 150, 130, 90, 40, $BS_MULTILINE)

; will be append dont' forget 3rd parameter
GUICtrlSetData($myedit, "2nd line" & @CRLF & "3rd line" & @CRLF & "4th line" & @CRLF & _
"5th line" & @CRLF & "6th line" & @CRLF & "7th line" & @CRLF & "8th line" & @CRLF & "9th line", 1)

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Btn_GET
$a_sel = _GUICtrlEditGetSel ($myedit)
If ($a_sel == $EC_ERR) Then
GUICtrlSetData($Status, "Error getting sel positions")
ElseIf (IsArray($a_sel)) Then
GUICtrlSetData($Status, "Starting Pos: " & $a_sel[1] & " Ending Pos: " & $a_sel[2])
Else
GUICtrlSetData($Status, "")
EndIf
EndSelect
WEnd


Function _GUICtrlEditLineFromChar

Function Reference

_GUICtrlEditLineFromChar

Retrieves the index of the line that contains the specified character index in a multiline edit control.

#Include <GuiEdit.au3>
_GUICtrlEditLineFromChar($h_edit[, $i_index = -1])

Parameters

$h_edit | control id/control hWnd
$i_index | Optional: Specifies the character index of the character contained in the line whose number is to be retrieved.

Return Value

The return value is the zero-based line number of the line containing the character index specified by $i_index.

Remarks

If $i_index is –1, _GUICtrlEditLineFromChar retrieves either the line number of the current line
(the line containing the caret) or, if there is a selection, the line number of the line containing
the beginning of the selection.

Related

_GUICtrlEditLineIndex

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $Status, $msg, $Btn_GET

GUICreate("Edit Line From Char", 392, 254)

$myedit = GUICtrlCreateEdit("First line" & @CRLF, 140, 32, 121, 97, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE))
GUICtrlSetLimit($myedit, 1500)
$Status = GUICtrlCreateLabel("", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
$Btn_GET = GUICtrlCreateButton("Get", 150, 130, 90, 40, $BS_MULTILINE)

; will be append dont' forget 3rd parameter
GUICtrlSetData($myedit, "2nd line" & @CRLF & "3rd line" & @CRLF & "4th line" & @CRLF & _
"5th line" & @CRLF & "6th line" & @CRLF & "7th line" & @CRLF & "8th line" & @CRLF & "9th line", 1)

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Btn_GET
GUICtrlSetData($Status, "Line From Char: " & _GUICtrlEditLineFromChar ($myedit))
EndSelect
WEnd


Function _GUICtrlEditLineIndex

Function Reference

_GUICtrlEditLineIndex

Retrieves the character index of the first character of a specified line in a multiline edit control.

#Include <GuiEdit.au3>
_GUICtrlEditLineIndex($h_edit[, $i_line = -1])

Parameters

$h_edit | control id/control hWnd
$i_line | Optional: Specifies the zero-based line number. A value of –1 specifies the current line number (the line that contains the caret).

Return Value

Success: | Returns the character index of the line specified in the $i_line parameter.
Failure: | Returns $EC_ERR if the specified line number is greater than the number of lines in the edit control.

Remarks

None.

Related

_GUICtrlEditLineFromChar

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $Status, $msg, $Btn_GET

GUICreate("Edit Line Index", 392, 254)

$myedit = GUICtrlCreateEdit("First line" & @CRLF, 140, 32, 121, 97, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE))
GUICtrlSetLimit($myedit, 1500)
$Status = GUICtrlCreateLabel("", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
$Btn_GET = GUICtrlCreateButton("Get", 150, 130, 90, 40, $BS_MULTILINE)

; will be append dont' forget 3rd parameter
GUICtrlSetData($myedit, "2nd line" & @CRLF & "3rd line" & @CRLF & "4th line" & @CRLF & _
"5th line" & @CRLF & "6th line" & @CRLF & "7th line" & @CRLF & "8th line" & @CRLF & "9th line", 1)

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Btn_GET
Local $index = _GUICtrlEditLineIndex ($myedit)
If ($index == $EC_ERR) Then
GUICtrlSetData($Status, "Character Index: Invalid Index")
Else
GUICtrlSetData($Status, "Character Index: " & $index)
EndIf
EndSelect
WEnd


Function _GUICtrlEditLineLength

Function Reference

_GUICtrlEditLineLength

Retrieves the length, in characters, of a line in an edit control.

#Include <GuiEdit.au3>
_GUICtrlEditLineLength($h_edit[, $i_index = -1])

Parameters

$h_edit | control id/control hWnd
$i_index | Optional: Specifies the character index of a character in the line whose length is to be retrieved.

Return Value

For multiline edit controls, the return value is the length, in TCHARs, of the line specified by the $i_index parameter.
For single-line edit controls, the return value is the length, in TCHARs, of the text in the edit control.

Remarks

$i_index
For ANSI text, this is the number of bytes
For Unicode text, this is the number of characters.
It does not include the carriage-return character at the end of the line.
If $i_index is greater than the number of characters in the control, the return value is zero.

Related

_GUICtrlEditGetLineCount

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $Status, $msg, $Btn_GET

GUICreate("Edit Line Length", 392, 254)

$myedit = GUICtrlCreateEdit("First line" & @CRLF, 140, 32, 121, 97, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE))
GUICtrlSetLimit($myedit, 1500)
$Status = GUICtrlCreateLabel("", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
$Btn_GET = GUICtrlCreateButton("Get", 150, 130, 90, 40, $BS_MULTILINE)

; will be append dont' forget 3rd parameter
GUICtrlSetData($myedit, "2nd line" & @CRLF & "3rd line" & @CRLF & "4th line" & @CRLF & _
"5th line" & @CRLF & "6th line" & @CRLF & "7th line" & @CRLF & "8th line" & @CRLF & "9th line", 1)

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Btn_GET
GUICtrlSetData($Status, "Line Length: " & _GUICtrlEditLineLength ($myedit))
EndSelect
WEnd


Function _GUICtrlEditLineScroll

Function Reference

_GUICtrlEditLineScroll

Scrolls the text in a multiline edit control.

#Include <GuiEdit.au3>
_GUICtrlEditLineScroll($h_edit, $i_horiz, $i_vert)

Parameters

$h_edit | control id/control hWnd
$i_horiz | Specifies the number of characters to scroll horizontally.
$i_vert | Specifies the number of lines to scroll vertically.

Return Value

Success: | Returns TRUE if the message is sent to a multiline edit control.
Failure: | Returns FALSE if the message is sent to a single-line edit control.

Remarks

The control does not scroll vertically past the last line of text in the edit control.
If the current line plus the number of lines specified by the $i_vert parameter exceeds the total number of lines in the edit control,
the value is adjusted so that the last line of the edit control is scrolled to the top of the edit-control window.

_GUICtrlEditLineScroll scrolls the text vertically or horizontally in a multiline edit control.
_GUICtrlEditLineScroll can be used to scroll horizontally past the last character of any line.

Related

_GUICtrlEditScroll

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $msg, $Btn_Scrollv, $Btn_Scrollh

GUICreate("Edit Line Scroll", 392, 254)

$myedit = GUICtrlCreateEdit("AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI." & @CRLF, 140, 32, 121, 97, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE, $WS_HSCROLL))
GUICtrlSetLimit($myedit, 1500)
$Btn_Scrollh = GUICtrlCreateButton("Scroll Horiz", 75, 140, 90, 30)
$Btn_Scrollv = GUICtrlCreateButton("Scroll Vert", 190, 140, 90, 30)

; will be append dont' forget 3rd parameter
GUICtrlSetData($myedit, "It uses a combination of simulated keystrokes, mouse movement and window/control manipulation" & @CRLF & _
"in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript" & @CRLF & _
"and SendKeys)." & @CRLF & _
'AutoIt was initially designed for PC "roll out" situations to configure thousands of PCs, but with the' & @CRLF & _
"arrival of v3 it is also well suited to performing home automation and the scripting of repetitive" & @CRLF & _
"tasks." & @CRLF & @CRLF & "AutoIt can:" & @CRLF & @CRLF & "Execute Windows and DOS executables", 1)

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Btn_Scrollv
_GUICtrlEditLineScroll ($myedit, 0, 1)
Case $msg = $Btn_Scrollh
_GUICtrlEditLineScroll ($myedit, 10, 0)
EndSelect
WEnd


Function _GUICtrlEditReplaceSel

Function Reference

_GUICtrlEditReplaceSel

Replaces the current selection in an edit control with the specified text.

#Include <GuiEdit.au3>
_GUICtrlEditReplaceSel($h_edit, $i_bool, $s_text)

Parameters

$h_edit | control id/control hWnd
$i_bool | Specifies whether the replacement operation can be undone. If this is TRUE, the operation can be undone. If this is FALSE , the operation cannot be undone.
$s_text | String containing the replacement text.

Return Value

None.

Remarks

Use the _GUICtrlEditReplaceSel to replace only a portion of the text in an edit control.
If there is no current selection, the replacement text is inserted at the current location of the caret.

Related

_GUICtrlEditGetSel, _GUICtrlEditSetSel

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $msg, $Btn_Replace

GUICreate("Edit Replace Sel", 392, 254)

$myedit = GUICtrlCreateEdit("AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI." & @CRLF, 140, 32, 121, 97, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE, $WS_HSCROLL))
GUICtrlSetLimit($myedit, 1500)
$Btn_Replace = GUICtrlCreateButton("Replace Sel", 150, 140, 90, 30)

; will be append dont' forget 3rd parameter
GUICtrlSetData($myedit, "It uses a combination of simulated keystrokes, mouse movement and window/control manipulation" & @CRLF & _
"in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript" & @CRLF & _
"and SendKeys)." & @CRLF & _
'AutoIt was initially designed for PC "roll out" situations to configure thousands of PCs, but with the' & @CRLF & _
"arrival of v3 it is also well suited to performing home automation and the scripting of repetitive" & @CRLF & _
"tasks." & @CRLF & @CRLF & "AutoIt can:" & @CRLF & @CRLF & "Execute Windows and DOS executables", 1)

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Btn_Replace
_GUICtrlEditReplaceSel ($myedit, 1, "Oops")
EndSelect
WEnd


Function _GUICtrlEditScroll

Function Reference

_GUICtrlEditScroll

Scrolls the text vertically in a multiline edit control.

#Include <GuiEdit.au3>
_GUICtrlEditScroll($h_edit, $i_direct)

Parameters

$h_edit | control id/control hWnd
$i_direct | Specifies the action the scroll bar is to take.

Return Value

Success: | Returns in the high-order word of the return value is TRUE, and in the low-order word is the number of lines that the command scrolls.
Failure: | Returns FALSE if the $i_direct parameter specifies an invalid value.

Remarks

$i_direct
This parameter can be one of the following values.

$SB_LINEDOWN | Scrolls down one line.
$SB_LINEUP | Scrolls up one line.
$SB_PAGEDOWN | Scrolls down one page.
$SB_PAGEUP | Scrolls up one page.
$SB_SCROLLCARET | Scrolls the caret into view

To scroll to a specific line or character position, use the _GUICtrlEditLineScroll.

Related

_GUICtrlEditLineScroll

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $msg, $Btn_linedown, $Btn_lineup, $Btn_pagedown, $Btn_pageup

GUICreate("Edit Scroll", 392, 254)

$myedit = GUICtrlCreateEdit("AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI." & @CRLF, 140, 32, 121, 97, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE, $WS_HSCROLL))
GUICtrlSetLimit($myedit, 1500)
$Btn_linedown = GUICtrlCreateButton("Line Down", 75, 140, 90, 30)
$Btn_lineup = GUICtrlCreateButton("Line Up", 75, 180, 90, 30)
$Btn_pagedown = GUICtrlCreateButton("Page Down", 190, 140, 90, 30)
$Btn_pageup = GUICtrlCreateButton("Page Up", 190, 180, 90, 30)

; will be append dont' forget 3rd parameter
GUICtrlSetData($myedit, "It uses a combination of simulated keystrokes, mouse movement and window/control manipulation" & @CRLF & _
"in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript" & @CRLF & _
"and SendKeys)." & @CRLF & _
'AutoIt was initially designed for PC "roll out" situations to configure thousands of PCs, but with the' & @CRLF & _
"arrival of v3 it is also well suited to performing home automation and the scripting of repetitive" & @CRLF & _
"tasks." & @CRLF & @CRLF & "AutoIt can:" & @CRLF & @CRLF & "Execute Windows and DOS executables", 1)

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Btn_linedown
_GUICtrlEditScroll ($myedit, $SB_LINEDOWN)
Case $msg = $Btn_lineup
_GUICtrlEditScroll ($myedit, $SB_LINEUP)
Case $msg = $Btn_pagedown
_GUICtrlEditScroll ($myedit, $SB_PAGEDOWN)
Case $msg = $Btn_pageup
_GUICtrlEditScroll ($myedit, $SB_PAGEUP)
EndSelect
WEnd


Function _GUICtrlEditSetModify

Function Reference

_GUICtrlEditSetModify

Sets or clears the modification flag for an edit control.

#Include <GuiEdit.au3>
_GUICtrlEditSetModify($h_edit, $i_bool)

Parameters

$h_edit | control id/control hWnd
$i_bool | Specifies the new value for the modification flag. A value of TRUE indicates the text has been modified. A value of FALSE indicates it has not been modified.

Return Value

None.

Remarks

The system automatically clears the modification flag to zero when the control is created.
If the user changes the control's text, the system sets the flag to nonzero.
You can use the _GUICtrlEditGetModify to retrieve the current state of the flag.

Related

_GUICtrlEditGetModify

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $ret, $Status, $msg, $current, $Btn_Set, $i_bool = 0

GUICreate("Edit Set Modify", 392, 254)

$myedit = GUICtrlCreateEdit("First line" & @CRLF, 140, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)
$Btn_Set = GUICtrlCreateButton("Set", 150, 140, 90, 30)

$Status = GUICtrlCreateLabel("Un-Modified", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
$ret = _GUICtrlEditGetModify ($myedit)
If ($ret <> $current) Then
If ($ret == 0) Then
GUICtrlSetData($Status, "Un-Modified")
Else
GUICtrlSetData($Status, "Modified")
EndIf
$current = $ret
EndIf
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Btn_Set
$i_bool = Not $i_bool
_GUICtrlEditSetModify ($myedit, $i_bool)
EndSelect
WEnd


Function _GUICtrlEditSetRECT

Function Reference

_GUICtrlEditSetRECT

Sets the formatting rectangle of an edit control.

#Include <GuiEdit.au3>
_GUICtrlEditSetRECT(Byref $h_edit, $left, $top, $right, $bottom)

Parameters

$h_edit | controlID
$left | Specifies the x-coordinate of the upper-left corner of the rectangle.
$top | Specifies the y-coordinate of the upper-left corner of the rectangle.
$right | Specifies the x-coordinate of the lower-right corner of the rectangle.
$bottom | Specifies the y-coordinate of the lower-right corner of the rectangle.

Return Value

None

Remarks

None.

Related

_GUICtrlEditGetRECT

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

Opt('MustDeclareVars', 1)

Dim $myedit, $Status, $msg, $s_rect, $label_rect, $rect_array, $btn_set

GUICreate("Edit Set Rect", 392, 254)
$myedit = GUICtrlCreateEdit("AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation" & @CRLF, 10, 32, 171, 97, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE))
GUICtrlSetLimit($myedit, 1500)
$label_rect = GUICtrlCreateLabel($s_rect, 195, 50, 100, 55, $SS_SUNKEN)
$btn_set = GUICtrlCreateButton("Set", 150, 150, 90, 40)
GUISetState()
$rect_array = _GUICtrlEditGetRECT($myedit)
If ($rect_array == $EC_ERR) Then
MsgBox(0, "Error", "Unable to Get RECT")
ElseIf (IsArray($rect_array)) Then
$s_rect = "Left:" & $rect_array[1] & @LF & "Top:" & $rect_array[2] & @LF & "Right:" & $rect_array[3] & @LF & "Bottom:" & $rect_array[4]
GUICtrlSetData($label_rect, $s_rect)
EndIf

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $btn_set
_GUICtrlEditSetRect($myedit, 0, 0, 80, $rect_array[4])
$rect_array = _GUICtrlEditGetRECT($myedit)
If ($rect_array == $EC_ERR) Then
MsgBox(0, "Error", "Unable to Get RECT")
ElseIf (IsArray($rect_array)) Then
$s_rect = "Left:" & $rect_array[1] & @LF & "Top:" & $rect_array[2] & @LF & "Right:" & $rect_array[3] & @LF & "Bottom:" & $rect_array[4]
GUICtrlSetData($label_rect, $s_rect)
EndIf
EndSelect
WEnd


Function _GUICtrlEditSetSel

Function Reference

_GUICtrlEditSetSel

Selects a range of characters in an edit control.

#Include <GuiEdit.au3>
_GUICtrlEditSetSel($h_edit, $i_start, $i_end)

Parameters

$h_edit | control id/control hWnd
$i_start | Specifies the starting character position of the selection.
$i_end | Specifies the ending character position of the selection.

Return Value

None.

Remarks

The start value can be greater than the end value.
The lower of the two values specifies the character position of the first character in the selection.
The higher value specifies the position of the first character beyond the selection.

The start value is the anchor point of the selection, and the end value is the active end.
If the user uses the SHIFT key to adjust the size of the selection, the active end can move but the anchor point remains the same.

If the $i_start is 0 and the $i_end is –1, all the text in the edit control is selected.
If the $i_start is –1, any current selection is deselected.

The control displays a flashing caret at the $i_end position regardless of the relative values of $i_start and $i_end.

Related

_GUICtrlEditGetSel

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $msg

GUICreate("Edit Set Sel", 392, 254)

$myedit = GUICtrlCreateEdit("AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI." & @CRLF, 140, 32, 121, 97, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE, $WS_HSCROLL))
GUICtrlSetLimit($myedit, 1500)

; will be append dont' forget 3rd parameter
GUICtrlSetData($myedit, "It uses a combination of simulated keystrokes, mouse movement and window/control manipulation" & @CRLF & _
"in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript" & @CRLF & _
"and SendKeys)." & @CRLF & _
'AutoIt was initially designed for PC "roll out" situations to configure thousands of PCs, but with the' & @CRLF & _
"arrival of v3 it is also well suited to performing home automation and the scripting of repetitive" & @CRLF & _
"tasks." & @CRLF & @CRLF & "AutoIt can:" & @CRLF & @CRLF & "Execute Windows and DOS executables", 1)

GUISetState()
_GUICtrlEditSetSel ($myedit, 0, 6)

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlEditUndo

Function Reference

_GUICtrlEditUndo

Undoes the last edit control operation in the control's undo queue.

#Include <GuiEdit.au3>
_GUICtrlEditUndo($h_edit)

Parameters

$h_edit control id/control hWnd

Return Value

Success: | Returns TRUE if the undo operation is successful.
Failure: | Returns FALSE if the undo operation fails.

Remarks

An undo operation can also be undone.
For example, you can restore deleted text with the first _GUICtrlEditUndo,
and remove the text again with a second _GUICtrlEditUndo as long as there
is no intervening edit operation.

Related

_GUICtrlEditCanUndo, _GUICtrlEditEmptyUndoBuffer, _GUICtrlEditGetModify

Example

#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $ret, $Status, $msg, $current, $Btn_Undo

GUICreate("Edit Undo", 392, 254)

$myedit = GUICtrlCreateEdit("First line" & @CRLF, 140, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)
$Btn_Undo = GUICtrlCreateButton("Undo", 150, 150)
$Status = GUICtrlCreateLabel("Nothing to Undo", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
$ret = _GUICtrlEditCanUndo ($myedit)
If ($ret <> $current) Then
If ($ret == 0) Then
GUICtrlSetData($Status, "Nothing to Undo")
Else
GUICtrlSetData($Status, "Undo Available")
EndIf
$current = $ret
EndIf
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Btn_Undo
_GUICtrlEditUndo ($myedit)
EndSelect
WEnd


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: GuiList Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_GUICtrlListAddDir | Add File/Folder names to the list displayed by the list box
_GUICtrlListAddItem | Add an item to the List
_GUICtrlListClear | Remove all items from the list box
_GUICtrlListCount | Get the number of items in the list box
_GUICtrlListDeleteItem | Delete an Item from the List
_GUICtrlListFindString | Return the index of matching item
_GUICtrlListGetAnchorIndex | Get the Anchor Index
_GUICtrlListGetCaretIndex | Return index of item that has the focus rectangle
_GUICtrlListGetHorizontalExtent | Retrieve from a list box the the scrollable width (pixels)
_GUICtrlListGetInfo | Retrieve the number of items per column in a specified list box.
_GUICtrlListGetItemRect | Retrieve the dimensions of the rectangle that bounds a list box item.
_GUICtrlListGetLocale | Current Locale of the listbox
_GUICtrlListGetSelCount | Get the number of items selected
_GUICtrlListGetSelItems | Get item indices of selected items
_GUICtrlListGetSelItemsText | Get the text of selected items
_GUICtrlListGetSelState | Get the selection state of item
_GUICtrlListGetText | Returns the item (string) at the specified index
_GUICtrlListGetTextLen | Alternative to StringLen
_GUICtrlListGetTopIndex | Retrieve the index of the first visible item in a list
_GUICtrlListInsertItem | Insert a string into the list
_GUICtrlListReplaceString | Replaces the text of an item at index
_GUICtrlListSelectedIndex | Return the index of selected item
_GUICtrlListSelectIndex | Select a string and scroll it into view, if necessary
_GUICtrlListSelectString | Select item using search string
_GUICtrlListSelItemRange | Select range by index in a multiple-selection list box
_GUICtrlListSelItemRangeEx | Selects items from $i_start to $i_stop
_GUICtrlListSetAnchorIndex | Set the Anchor Index
_GUICtrlListSetCaretIndex | Set the focus rectangle to the item at the specified index.
_GUICtrlListSetHorizontalExtent | Set the width, in pixels, by which a list box can be scrolled horizontally
_GUICtrlListSetLocale | Set the locale
_GUICtrlListSetSel | Select string(s) in a multiple-selection list box
_GUICtrlListSetTopIndex | Ensure that a particular item in a list box is visible
_GUICtrlListSort | Re-sorts list box if it has the $LBS_SORT style
_GUICtrlListSwapString | Swaps the text of two items at the specified indices


Function _GUICtrlListAddDir

Function Reference

_GUICtrlListAddDir

Add File/Folder names to the list displayed by the list box

#Include <GuiList.au3>
_GUICtrlListAddDir($h_listbox, $s_Attributes[, $s_file=""])

Parameters

$h_listbox | control id/control hWnd
$s_Attributes | Comma-delimited string eg "A,H" "D,A" "Drives"
$s_file | Optional for "Drives" only: What Files/Folders to get eg *.*

Return Value

zero-based index of the last name added to the list
If an error occurs, the return value is $LB_ERR.
If there is insufficient space to store the new strings, the return value is $LB_ERRSPACE

Remarks

Requirement: $s_file for all but drives attribute

$s_Attributes is an comma-delimited string
valid values are any of the following:
A,D,H,RO,RW,S,E,Drives,NB

A = ARCHIVE | Includes archived files.
D = DIRECTORY | Includes subdirectories. Subdirectory names are enclosed in square brackets ([ ]).
H = HIDDEN | Includes hidden files.
RO = READONLY | Includes read-only files.
RW = READWRITE | Includes read-write files with no additional attributes. This is the default setting.
S = SYSTEM | Includes system files.
E = EXCLUSIVE | Includes only files with the specified attributes. By default, read-write files are listed even if READWRITE is not specified.
DRIVES | All mapped drives are added to the list. Drives are listed in the form [-x-], where x is the drive letter.
NB = No Brackets | 0
Drives are listed in the form x:, where x is the drive letter (used with Drives attribute) | 0

Related

_GUICtrlListDeleteItem, _GUICtrlListClear

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt('MustDeclareVars', 1)

Dim $a_check[10], $msg, $ret, $s_attr
Dim $input, $group, $a_attr, $listbox, $button, $btn_exit

GUICreate("ListBox Add Item Demo", 400, 250, -1, -1)
GUICtrlCreateLabel("Enter files to find", 25, 15)
$input = GUICtrlCreateInput("", 125, 10, 180, 25)
$group = GUICtrlCreateGroup("Atrributes", 10, 40, -1, 200)
$a_attr = StringSplit("A,D,H,RO,RW,S,E,Drives,NB", ",")
$a_check[0] = 9
$a_check[1] = GUICtrlCreateCheckbox("Archive", 15, 55, 170, 20)
$a_check[2] = GUICtrlCreateCheckbox("Directory", 15, 75, 170, 20)
$a_check[3] = GUICtrlCreateCheckbox("Hidden", 15, 95, 170, 20)
$a_check[4] = GUICtrlCreateCheckbox("Read-Only", 15, 115, 170, 20)
$a_check[5] = GUICtrlCreateCheckbox("Read-Write", 15, 135, 95, 20)
$a_check[6] = GUICtrlCreateCheckbox("System", 15, 155, 170, 20)
$a_check[7] = GUICtrlCreateCheckbox("Exclusive", 15, 175, 170, 20)
$a_check[8] = GUICtrlCreateCheckbox("Drives", 15, 195, 170, 20)
$a_check[9] = GUICtrlCreateCheckbox("No Brackets (Drives Only)", 15, 215, 170, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

$listbox = GUICtrlCreateList("", 240, 40, 120, 120)
$button = GUICtrlCreateButton("Get Names", 240, 160, 120, 40)
$btn_exit = GUICtrlCreateButton("Exit", 240, 205, 120, 40)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $btn_exit
ExitLoop
Case $msg = $button
$s_attr = ""
For $i = 1 To $a_check[0]
If (BitAND(GUICtrlRead($a_check[$i]), $GUI_CHECKED)) Then
If (StringLen($s_attr) > 0) Then
$s_attr &= "," & $a_attr[$i]
Else
$s_attr = $a_attr[$i]
EndIf
EndIf
Next
_GUICtrlListClear ($listbox)
$ret = _GUICtrlListAddDir ($listbox, $s_attr, GUICtrlRead($input))
If ($ret < 0) Then
If ($ret == $LB_ERRATTRIBUTE) Then
MsgBox(16, "Error", "Invalid Attribute sent to _GUICtrlListAddDir")
ElseIf ($ret == $LB_ERRSPACE) Then
MsgBox(16, "Error", "insufficient space to store the new strings from calling _GUICtrlListAddDir")
ElseIf ($ret == $LB_ERRREQUIRED) Then
MsgBox(16, "Error", "Argument required for file search in call to _GUICtrlListAddDir")
ElseIf ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListAddDir" & @CRLF & "Possibly no files/folders found")
EndIf
EndIf
EndSelect
WEnd


Function _GUICtrlListAddItem

Function Reference

_GUICtrlListAddItem

Add an item to the List

#Include <GuiList.au3>
_GUICtrlListAddItem($h_listbox, $s_text)

Parameters

$h_listbox | control id/control hWnd
$s_text | String to add

Return Value

The return value is the zero-based index of the string in the list box.
If an error occurs, the return value is $LB_ERR.
If there is insufficient space to store the new string, the return value is $LB_ERRSPACE.

Remarks

If the list box does not have the $LBS_SORT style, the string is added to the
end of the list. Otherwise, the string is inserted into the list and the list
is sorted.

Related

_GUICtrlListDeleteItem, _GUICtrlListInsertItem, _GUICtrlListReplaceString, _GUICtrlListSwapString

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $input, $listbox, $button

GUICreate("ListBox Add Item Demo", 400, 250, -1, -1)
GUICtrlCreateLabel("Enter item to add", 25, 15)
$input = GUICtrlCreateInput("", 125, 10, 180, 25)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
$button = GUICtrlCreateButton("Add to List", 150, 160, 120, 40)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
If (StringLen(GUICtrlRead($input)) > 0) Then
$ret = _GUICtrlListAddItem ($listbox, GUICtrlRead($input))
If ($ret < 0) Then
If ($ret == $LB_ERRSPACE) Then
MsgBox(16, "Error", "insufficient space to store the new strings from calling _GUICtrlListAddItem")
ElseIf ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListAddItem")
EndIf
EndIf
EndIf
EndSelect
WEnd


Function _GUICtrlListClear

Function Reference

_GUICtrlListClear

Remove all items from the list box

#Include <GuiList.au3>
_GUICtrlListClear($h_listbox)

Parameters

$h_listbox control id/control hWnd

Return Value

None.

Remarks

None.

Related

_GUICtrlListDeleteItem, _GUICtrlListAddItem, _GUICtrlListInsertItem

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $button

GUICreate("ListBox Clear All Items Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|test2|test3|")
$button = GUICtrlCreateButton("Clear All", 150, 160, 120, 40)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
_GUICtrlListClear ($listbox)
EndSelect
WEnd


Function _GUICtrlListCount

Function Reference

_GUICtrlListCount

Get the number of items in the list box

#Include <GuiList.au3>
_GUICtrlListCount($h_listbox)

Parameters

$h_listbox control id/control hWnd

Return Value

The return value is the number of items in the list box
or $LB_ERR if an error occurs

Remarks

None.

Related

_GUICtrlListGetSelCount, _GUICtrlListGetSelItems, _GUICtrlListGetSelItemsText

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $button, $label

GUICreate("ListBox Count Item(s) Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|test2|test3|")
$button = GUICtrlCreateButton("Count Items", 150, 160, 120, 40)
$label = GUICtrlCreateLabel("# of Items", 150, 210, 120)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListCount ($listbox)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListCount")
Else
GUICtrlSetData($label, "# of Items: " & $ret)
EndIf
EndSelect
WEnd


Function _GUICtrlListDeleteItem

Function Reference

_GUICtrlListDeleteItem

Delete an Item from the List

#Include <GuiList.au3>
_GUICtrlListDeleteItem($h_listbox, $i_index)

Parameters

$h_listbox | control id/control hWnd
$i_index | Zero-based index of item to delete

Return Value

The return value is a count of the strings remaining in the list.
The return value is $LB_ERR if the $i_index parameter specifies an
index greater than the number of items in the list.

Remarks

None.

Related

_GUICtrlListAddItem, _GUICtrlListInsertItem, _GUICtrlListClear

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $button

GUICreate("ListBox Delete Item Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|test2|test3|")
$button = GUICtrlCreateButton("Delete item #2", 150, 160, 120, 40)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListDeleteItem ($listbox, 1)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListDeleteItem")
EndIf
EndSelect
WEnd


Function _GUICtrlListFindString

Function Reference

_GUICtrlListFindString

Return the index of matching item

#Include <GuiList.au3>
_GUICtrlListFindString($h_listbox, $s_search[, $i_exact=0])

Parameters

$h_listbox | control id/control hWnd
$s_search | string to search for
$i_exact | Optional: exact match or not

Return Value

The return value is the index of the matching item,
or $LB_ERR if the search was unsuccessful.

Remarks

Finds the first string in a list box that begins with the specified string.
If exact is specified find the first list box string that exactly matches
the specified string, except that the search is not case sensitive

Related

None.

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $input, $listbox, $button, $label, $button2

GUICreate("ListBox Find String Demo", 400, 250, -1, -1)
GUICtrlCreateLabel("Enter item to add", 25, 15)
$input = GUICtrlCreateInput("", 125, 10, 180, 25)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
$button = GUICtrlCreateButton("Begins with", 85, 160, 120, 40)
$button2 = GUICtrlCreateButton("Exact Match", 215, 160, 120, 40)
$label = GUICtrlCreateLabel("Item #", 150, 210, 120)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
If (StringLen(GUICtrlRead($input)) > 0) Then
$ret = _GUICtrlListFindString ($listbox, GUICtrlRead($input))
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListFindString")
Else
GUICtrlSetData($label, "Item #: " & $ret)
EndIf
EndIf
Case $msg = $button2
If (StringLen(GUICtrlRead($input)) > 0) Then
$ret = _GUICtrlListFindString($listbox, GUICtrlRead($input), 1)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListFindString")
Else
GUICtrlSetData($label, "Item #: " & $ret)
EndIf
EndIf
EndSelect
WEnd


Function _GUICtrlListGetAnchorIndex

Function Reference

_GUICtrlListGetAnchorIndex

Get the Anchor Index

#Include <GuiList.au3>
_GUICtrlListGetAnchorIndex($h_listbox)

Parameters

$h_listbox control id/control hWnd

Return Value

The return value is the index of the anchor item.
If an error occurs, the return value is $LB_ERR

Remarks

DOES NOT WORK WITH SINGLE-SELECTION LIST BOXES
This might not always be the first selected item--especially
if you select every other item via Ctrl+Click...

Related

_GUICtrlListSetAnchorIndex

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret, $listbox, $button, $label

GUICreate("ListBox Get Anchor Index Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
$button = GUICtrlCreateButton("Get Anchor", 150, 160, 120, 40)
$label = GUICtrlCreateLabel("Anchor Index:", 150, 210, 120)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListGetAnchorIndex ($listbox)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListGetAnchorIndex")
Else
GUICtrlSetData($label, "Anchor Index: " & $ret)
EndIf
EndSelect
WEnd


Function _GUICtrlListGetCaretIndex

Function Reference

_GUICtrlListGetCaretIndex

Return index of item that has the focus rectangle

#Include <GuiList.au3>
_GUICtrlListGetCaretIndex($h_listbox)

Parameters

$h_listbox control id/control hWnd

Return Value

The return value is the zero-based index of the selected list box item.
If nothing is selected $LB_ERR can be returned.

Remarks

To determine the index of the item that has the focus rectangle in a
multiple-selection list box. The item may or may not be selected

Related

_GUICtrlListGetTopIndex, _GUICtrlListGetAnchorIndex

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $label, $button

GUICreate("ListBox Get Caret Index Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
$button = GUICtrlCreateButton("Get Index", 150, 160, 120, 40)
$label = GUICtrlCreateLabel("Item #", 150, 210, 120)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListGetCaretIndex ($listbox)
GUICtrlSetData($label, "Item : " & $ret)
EndSelect
WEnd


Function _GUICtrlListGetHorizontalExtent

Function Reference

_GUICtrlListGetHorizontalExtent

Retrieve from a list box the the scrollable width (pixels)

#Include <GuiList.au3>
_GUICtrlListGetHorizontalExtent($h_listbox)

Parameters

$h_listbox control id/control hWnd

Return Value

The return value is the scrollable width, in pixels, of the list box.

Remarks

The list box must have been defined with the $WS_HSCROLL style.

Related

_GUICtrlListSetHorizontalExtent

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $listbox, $label

GUICreate("ListBox Get Horizontal Extent", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 100, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_DISABLENOSCROLL, $WS_HSCROLL))
_GUICtrlListSetHorizontalExtent ($listbox, 120)
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|")
$label = GUICtrlCreateLabel("HorizontalExtent: " & _GUICtrlListGetHorizontalExtent ($listbox), 150, 210, 120)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlListGetInfo

Function Reference

_GUICtrlListGetInfo

Retrieve the number of items per column in a specified list box.

#Include <GuiList.au3>
_GUICtrlListGetInfo($h_listbox)

Parameters

$h_listbox control id/control hWnd

Return Value

The return value is the number of items per column.

Remarks

Minimum operating systems Windows XP

Related

None.

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $listbox, $label

GUICreate("ListBox Get Info", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 100, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY))
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|")
$label = GUICtrlCreateLabel("Info: " & _GUICtrlListGetInfo ($listbox), 150, 210, 120)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlListGetItemRect

Function Reference

_GUICtrlListGetItemRect

Retrieve the dimensions of the rectangle that bounds a list box item.

#Include <GuiList.au3>
_GUICtrlListGetItemRect($h_listbox, $i_index)

Parameters

$h_listbox | control id/control hWnd
$i_index | Specifies the zero-based index of the item.

Return Value

Array containing the RECT, first element ($array[0]) contains the number of elements
If an error occurs, the return value is $LB_ERR.

Remarks

$array[1] - left
$array[2] - top
$array[3] - right
$array[4] - bottom

Related

None.

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

opt('MustDeclareVars', 1)

Dim $listbox, $s_rect, $label_rect, $Btn_GETRECT, $Btn_Exit, $msg

GUICreate("ListBox Get Item RECT", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 50, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")

$s_rect = "Left:" & @LF & "Top:" & @LF & "Right:" & @LF & "Bottom:"
$label_rect = GUICtrlCreateLabel($s_rect, 270, 40, 100, 55, $SS_SUNKEN)

$Btn_GETRECT = GUICtrlCreateButton("Get Item Rect", 270, 120, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 180, 90, 30)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_GETRECT
Local $rect_array = _GUICtrlListGetItemRect($listbox, 3)
If (IsArray($rect_array)) Then
$s_rect = "Left:" & $rect_array[1] & @LF & "Top:" & $rect_array[2] & @LF & "Right:" & $rect_array[3] & @LF & "Bottom:" & $rect_array[4]
GUICtrlSetData($label_rect, $s_rect)
EndIf
EndSelect
WEnd


Function _GUICtrlListGetLocale

Function Reference

_GUICtrlListGetLocale

Current Locale of the listbox

#Include <GuiList.au3>
_GUICtrlListGetLocale($h_listbox)

Parameters

$h_listbox control id/control hWnd

Return Value

Returns the current Local of the listbox
same as @OSLang unless changed

Remarks

"0409" for U.S. English

Related

_GUICtrlListSetLocale

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret, $listbox, $button

GUICreate("ListBox Get Locale Demo", 400, 250, -1, -1)
$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
$button = GUICtrlCreateButton('Get Locale', 150, 160, 120, 40)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListGetLocale ($listbox)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListGetLocale")
Else
MsgBox(0, "Locale", $ret)
EndIf
EndSelect
WEnd


Function _GUICtrlListGetSelCount

Function Reference

_GUICtrlListGetSelCount

Get the number of items selected

#Include <GuiList.au3>
_GUICtrlListGetSelCount($h_listbox)

Parameters

$h_listbox control id/control hWnd

Return Value

The return value is the count of selected items in the list box.
If the list box is a single-selection list box, the return value is $LB_ERR.

Remarks

Retrieve the total number of selected items in a multiple-selection list box.
Number of selected items (for a control with multi-select style)

Related

_GUICtrlListGetSelItems, _GUICtrlListGetSelItemsText, _GUICtrlListSetSel

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $button, $label

GUICreate("ListBox Selected Count Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
$button = GUICtrlCreateButton("Get Sel Count", 150, 160, 120, 40)
$label = GUICtrlCreateLabel("# Selected: ", 150, 210, 120)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListGetSelCount ($listbox)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListGetSelCount")
Else
GUICtrlSetData($label, "# Selected: " & $ret)
EndIf
EndSelect
WEnd


Function _GUICtrlListGetSelItems

Function Reference

_GUICtrlListGetSelItems

Get item indices of selected items

#Include <GuiList.au3>
_GUICtrlListGetSelItems($h_listbox)

Parameters

$h_listbox control id/control hWnd

Return Value

Array of selected items indices, first element ($array[0]) contains the number indices returned
If the list box is a single-selection list box, the return value is $LB_ERR.
If no items are selected, the return value is $LB_ERR.

Remarks

None.

Related

_GUICtrlListSelectedIndex, _GUICtrlListGetSelState, _GUICtrlListGetSelCount, _GUICtrlListGetSelItemsText, _GUICtrlListGetSelItems, _GUICtrlListSelItemRange, _GUICtrlListSelItemRangeEx

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret, $listbox, $button, $i

GUICreate("ListBox Selected Items Indices Demo", 400, 250, -1, -1)
$listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
$button = GUICtrlCreateButton("Get Selected", 150, 160, 120, 40)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListGetSelItems ($listbox)
If (Not IsArray($ret)) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListGetSelItems")
Else
For $i = 1 To $ret[0]
MsgBox(0, "Selected", $ret[$i])
Next
EndIf
EndSelect
WEnd


Function _GUICtrlListGetSelItemsText

Function Reference

_GUICtrlListGetSelItemsText

Get the text of selected items

#Include <GuiList.au3>
_GUICtrlListGetSelItemsText($h_listbox)

Parameters

$h_listbox control id/control hWnd

Return Value

Array of selected items text, first element ($array[0]) contains the number items returned
If the list box is a single-selection list box, the return value is $LB_ERR.
If no items are selected, the return value is $LB_ERR.

Remarks

None.

Related

_GUICtrlListSelectedIndex, _GUICtrlListGetSelState, _GUICtrlListGetSelCount, _GUICtrlListGetSelItemsText

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $button, $label, $i

GUICreate("ListBox Selected Items Text Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
$button = GUICtrlCreateButton("Get Selected", 150, 160, 120, 40)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListGetSelItemsText ($listbox)
If (Not IsArray($ret)) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListGetSelItemsText")
Else
For $i = 1 To $ret[0]
MsgBox(0, "Selected", $ret[$i])
Next
EndIf
EndSelect
WEnd


Function _GUICtrlListGetSelState

Function Reference

_GUICtrlListGetSelState

Get the selection state of item

#Include <GuiList.au3>
_GUICtrlListGetSelState($h_listbox, $i_index)

Parameters

$h_listbox | control id/control hWnd
$i_index | Specifies the zero-based index of the item

Return Value

If an item is selected, the return value is greater than zero
otherwise, it is zero. If an error occurs, the return value is $LB_ERR.

Remarks

None.

Related

_GUICtrlListSelectedIndex, _GUICtrlListGetSelCount, _GUICtrlListGetSelItems, _GUICtrlListGetSelItemsText

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $button, $label

GUICreate("ListBox Selected State Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|test2|test3|")
$button = GUICtrlCreateButton("Get Index 2 State", 150, 160, 120, 40)
$label = GUICtrlCreateLabel("State: ", 150, 210, 120)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListGetSelState ($listbox, 2)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListGetSelState")
Else
GUICtrlSetData($label, "State: " & $ret)
EndIf
EndSelect
WEnd


Function _GUICtrlListGetText

Function Reference

_GUICtrlListGetText

Returns the item (string) at the specified index

#Include <GuiList.au3>
_GUICtrlListGetText($h_listbox, $i_index)

Parameters

$h_listbox | control id/control hWnd
$i_index | Specifies the zero-based index of the string to retrieve

Return Value

The return value is the item string
If $i_index does not specify a valid index, the return value is $LB_ERR.

Remarks

None.

Related

_GUICtrlListGetSelItemsText, _GUICtrlListGetTextLen

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $label

GUICreate("ListBox Get Text Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
$label = GUICtrlCreateLabel("Item #", 150, 210, 120)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $listbox
$ret = _GUICtrlListGetText ($listbox, _GUICtrlListSelectedIndex ($listbox))
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListGetText")
Else
GUICtrlSetData($label, "Item : " & $ret)
EndIf
EndSelect
WEnd


Function _GUICtrlListGetTextLen

Function Reference

_GUICtrlListGetTextLen

Alternative to StringLen

#Include <GuiList.au3>
_GUICtrlListGetTextLen($h_listbox, $i_index)

Parameters

$h_listbox | control id/control hWnd
$i_index | Zero-based index of item

Return Value

The return value is the length of the string
If the $i_index parameter does not specify a valid index, the return value is $LB_ERR

Remarks

None.

Related

None.

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret, $listbox, $button

GUICreate("ListBox Text Len Demo", 400, 250, -1, -1)
GUICtrlCreateLabel("Select from list", 125, 10)
$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
$button = GUICtrlCreateButton('Exit', 150, 160, 120, 40)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $button
ExitLoop
Case $msg = $listbox
$ret = _GUICtrlListGetTextLen ($listbox, _GUICtrlListSelectedIndex ($listbox))
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListGetTextLen")
Else
MsgBox(0, "Text", "Length: " & $ret)
EndIf
EndSelect
WEnd


Function _GUICtrlListGetTopIndex

Function Reference

_GUICtrlListGetTopIndex

Retrieve the index of the first visible item in a list

#Include <GuiList.au3>
_GUICtrlListGetTopIndex($h_listbox)

Parameters

$h_listbox control id/control hWnd

Return Value

The return value is the index of the first visible item in the list box.
If the list is empty then $LB_ERR is returned.

Remarks

Initially the item with index 0 is at the top of the list box, but if
the list box contents have been scrolled another item may be at the top.
Returns index of the first visible item in the list box
useful since contents for a long list will scroll

Related

_GUICtrlListSetTopIndex

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $button, $label, $i

GUICreate("ListBox Get Top Index Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|")
$button = GUICtrlCreateButton("Get Top Index", 150, 160, 120, 40)
$label = GUICtrlCreateLabel("Top Index:", 150, 210, 120)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListGetTopIndex ($listbox)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListGetTopIndex")
Else
GUICtrlSetData($label, "Top Index: " & $ret)
EndIf
EndSelect
WEnd


Function _GUICtrlListInsertItem

Function Reference

_GUICtrlListInsertItem

Insert a string into the list

#Include <GuiList.au3>
_GUICtrlListInsertItem($h_listbox, $s_text[, $i_index=-1])

Parameters

$h_listbox | control id/control hWnd
$s_text | String to insert
$i_index | Optional: Zero-based index to insert at

Return Value

The return value is the index of the position at which the string was inserted.
If an error occurs, the return value is $LB_ERR. If there is insufficient space
to store the new string, the return value is $LB_ERRSPACE.

Remarks

If this parameter is –1, the string is added to the end of the list.
Unlike the _GUICtrlListAddItem, this function does not cause a list
with the $LBS_SORT style to be sorted.

Related

_GUICtrlListAddItem

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $input, $listbox, $button, $label, $button2

GUICreate("ListBox Insert Item Demo", 400, 250, -1, -1)
GUICtrlCreateLabel("Enter item to add", 25, 15)
$input = GUICtrlCreateInput("", 125, 10, 180, 25)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
$button = GUICtrlCreateButton("Insert", 85, 160, 120, 40)
$button2 = GUICtrlCreateButton("Append", 215, 160, 120, 40)
$label = GUICtrlCreateLabel("Item #", 150, 210, 120)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
If (StringLen(GUICtrlRead($input)) > 0) Then
$ret = _GUICtrlListInsertItem ($listbox, GUICtrlRead($input), 2)
If ($ret < 0) Then
MsgBox(16, "Error", "Error (" & $ret & ") from _GUICtrlListInsertItem")
Else
GUICtrlSetData($label, "Item #: " & $ret)
EndIf
EndIf
Case $msg = $button2
If (StringLen(GUICtrlRead($input)) > 0) Then
$ret = _GUICtrlListInsertItem ($listbox, GUICtrlRead($input))
If ($ret < 0) Then
MsgBox(16, "Error", "Error (" & $ret & ") from _GUICtrlListInsertItem")
Else
GUICtrlSetData($label, "Item #: " & $ret)
EndIf
EndIf
EndSelect
WEnd


Function _GUICtrlListReplaceString

Function Reference

_GUICtrlListReplaceString

Replaces the text of an item at index

#Include <GuiList.au3>
_GUICtrlListReplaceString($h_listbox, $i_index, $s_newString)

Parameters

$h_listbox | control id/control hWnd
$i_index | Zero-based index of the item to replace
$s_newString | String to replace old string

Return Value

If an error occurs, the return value is $LB_ERR

Remarks

None.

Related

None.

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret, $listbox, $button

GUICreate("ListBox Replace String Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
$button = GUICtrlCreateButton('Set Item 3 to "gone"', 150, 160, 120, 40)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListReplaceString ($listbox, 3, "gone")
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListReplaceString")
EndIf
EndSelect
WEnd


Function _GUICtrlListSelectedIndex

Function Reference

_GUICtrlListSelectedIndex

Return the index of selected item

#Include <GuiList.au3>
_GUICtrlListSelectedIndex($h_listbox)

Parameters

$h_listbox control id/control hWnd

Return Value

In a single-selection list box, the return value is the zero-based
index of the currently selected item. If there is no selection,
the return value is $LB_ERR

Remarks

Do "NOT" use this with a multiple-selection list box.

Related

_GUICtrlListGetSelCount, _GUICtrlListGetSelItems, _GUICtrlListGetSelItemsText

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $label

GUICreate("ListBox Current Selection Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
$label = GUICtrlCreateLabel("Item #", 150, 210, 120)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $listbox
$ret = _GUICtrlListSelectedIndex ($listbox)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListSelectedIndex")
Else
GUICtrlSetData($label, "Item #: " & $ret)
EndIf
EndSelect
WEnd


Function _GUICtrlListSelectIndex

Function Reference

_GUICtrlListSelectIndex

Select a string and scroll it into view, if necessary

#Include <GuiList.au3>
_GUICtrlListSelectIndex($h_listbox, $i_index)

Parameters

$h_listbox | controlID/control hWnd
$i_index | Specifies the zero-based index of the list box item

Return Value

If an error occurs, the return value is $LB_ERR.
If the $i_index parameter is –1, the return value is $LB_ERR even though no error occurred.

Remarks

Use this message only with single-selection list boxes.
You cannot use it to set or remove a selection in a multiple-selection list box.

Related

_GUICtrlListSetSel, _GUICtrlListSelectString, _GUICtrlListGetSelState, _GUICtrlListGetSelCount, _GUICtrlListGetSelItems

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

opt('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $button, $button2

GUICreate("ListBox Set Selection(s) Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY))
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
$button = GUICtrlCreateButton("Set index 3", 160, 160, 120, 40)
$button2 = GUICtrlCreateButton("Set index 12", 160, 210, 120, 40)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListSelectIndex ($listbox, 3)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListSelectIndex")
EndIf
Case $msg = $button2
$ret = _GUICtrlListSelectIndex ($listbox, 12)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListSelectIndex")
EndIf
EndSelect
WEnd


Function _GUICtrlListSelectString

Function Reference

_GUICtrlListSelectString

Select item using search string

#Include <GuiList.au3>
_GUICtrlListSelectString($h_listbox, $s_search[, $i_index=-1])

Parameters

$h_listbox | control id/control hWnd
$s_text | String to select
$i_index | Optional: Zero-based index of the item before the first item to be searched

Return Value

If the search is successful, the return value is the index of the selected item.
If the search is unsuccessful, the return value is $LB_ERR and the current selection is not changed.

Remarks

If $i_index is –1, the entire list box is searched from the beginning

Related

_GUICtrlListFindString

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $input, $listbox, $button, $label, $button2

GUICreate("ListBox Select String Demo", 400, 250, -1, -1)
GUICtrlCreateLabel("Enter String to Select", 25, 15)
$input = GUICtrlCreateInput("", 125, 10, 180, 25)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
$button = GUICtrlCreateButton("Start from index 3", 85, 160, 120, 40)
$button2 = GUICtrlCreateButton("Start from index 0", 215, 160, 120, 40)
$label = GUICtrlCreateLabel("Item #", 150, 210, 120)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
If (StringLen(GUICtrlRead($input)) > 0) Then
$ret = _GUICtrlListSelectString ($listbox, GUICtrlRead($input), 3)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Not Found")
Else
GUICtrlSetData($label, "Item #: " & $ret)
EndIf
EndIf
Case $msg = $button2
If (StringLen(GUICtrlRead($input)) > 0) Then
$ret = _GUICtrlListSelectString ($listbox, GUICtrlRead($input))
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Not Found")
Else
GUICtrlSetData($label, "Item #: " & $ret)
EndIf
EndIf
EndSelect
WEnd


Function _GUICtrlListSelItemRange

Function Reference

_GUICtrlListSelItemRange

Select range by index in a multiple-selection list box

#Include <GuiList.au3>
_GUICtrlListSelItemRange($h_listbox, $i_flag, $i_start, $i_stop)

Parameters

$h_listbox | control id/control hWnd
$i_flag | Set/Remove select
$i_start | Zero-based index of the first item to select
$i_stop | Zero-based index of the last item to select

Return Value

If an error occurs, the return value is $LB_ERR

Remarks

DOES NOT WORK WITH SINGLE-SELECTION LIST BOXES
Select items from $i_start to $stop indices (inclusive)
Can select a range only within the first 65,536 items
$i_flag == 1 selects
$i_flag == 0 removes select

Related

_GUICtrlListSelItemRangeEx

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt('MustDeclareVars',1)

Dim $msg, $ret,$listbox,$button,$i_sel=1

GUICreate("ListBox Set Item Range Demo",400,250,-1,-1)

$listbox = GUICtrlCreateList("",125,40,180,120,BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY,$LBS_MULTIPLESEL))
GUICtrlSetData($listbox,"test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
$button = GUICtrlCreateButton("Set/UnSet Items 1 - 5",150,160,120,40)

GUISetState ()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListSelItemRange($listbox,$i_sel,1,5)
If($ret == $LB_ERR) Then
MsgBox(16,"Error","Unknown error from _GUICtrlListSelItemRange")
EndIf
$i_sel = Not $i_sel
EndSelect
Wend


Function _GUICtrlListSelItemRangeEx

Function Reference

_GUICtrlListSelItemRangeEx

Selects items from $i_start to $i_stop

#Include <GuiList.au3>
_GUICtrlListSelItemRangeEx($h_listbox, $i_start, $i_stop)

Parameters

$h_listbox | control id/control hWnd
$i_start | Zero-based index of the first item to select
$i_stop | Zero-based index of the last item to select

Return Value

If an error occurs, the return value is $LB_ERR

Remarks

DOES NOT WORK WITH SINGLE-SELECTION LIST BOXES
If $i_start > $i_stop Then items are un-selected

Related

_GUICtrlListSelItemRange

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt('MustDeclareVars',1)

Dim $msg, $ret,$listbox,$button,$button2

GUICreate("ListBox Set Item RangeEx Demo",400,250,-1,-1)

$listbox = GUICtrlCreateList("",125,40,180,120,BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY,$LBS_MULTIPLESEL))
GUICtrlSetData($listbox,"test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
$button = GUICtrlCreateButton("Set Items 1 - 5",85,160,120,40)
$button2 = GUICtrlCreateButton("UnSet Items 1 - 5",220,160,120,40)

GUISetState ()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListSelItemRangeEx($listbox,1,5)
If($ret == $LB_ERR) Then
MsgBox(16,"Error","Unknown error from _GUICtrlListSelItemRangeEx")
EndIf
Case $msg = $button2
$ret = _GUICtrlListSelItemRangeEx($listbox,5,1)
If($ret == $LB_ERR) Then
MsgBox(16,"Error","Unknown error from _GUICtrlListSelItemRangeEx")
EndIf
EndSelect
Wend


Function _GUICtrlListSetAnchorIndex

Function Reference

_GUICtrlListSetAnchorIndex

Set the Anchor Index

#Include <GuiList.au3>
_GUICtrlListSetAnchorIndex($h_listbox, $i_index)

Parameters

$h_listbox | control id/control hWnd
$i_index | Specifies the index of the new anchor item.

Return Value

If the message succeeds, the return value is zero.
If the message fails, the return value is $LB_ERR.

Remarks

DOES NOT WORK WITH SINGLE-SELECTION LIST BOXES

Related

_GUICtrlListGetAnchorIndex

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret, $listbox, $button, $label

GUICreate("ListBox Set Anchor Index Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
$button = GUICtrlCreateButton("Set Anchor", 150, 160, 120, 40)
$label = GUICtrlCreateLabel("Anchor Index:", 150, 210, 120)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListSetAnchorIndex ($listbox, 5)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListGetAnchorIndex")
Else
$ret = _GUICtrlListGetAnchorIndex ($listbox)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error", "Unknown error from _GUICtrlListGetAnchorIndex")
Else
GUICtrlSetData($label, "Anchor Index: " & $ret)
EndIf
EndIf
EndSelect
WEnd


Function _GUICtrlListSetCaretIndex

Function Reference

_GUICtrlListSetCaretIndex

Set the focus rectangle to the item at the specified index.

#Include <GuiList.au3>
_GUICtrlListSetCaretIndex($h_listbox, $i_index[, $i_bool=1])

Parameters

$h_listbox | control id/control hWnd
$i_index | Specifies the zero-based index of the list box item that is to receive the focus rectangle.
$i_bool | Optional: If this value is FALSE, the item is scrolled until it is fully visible. If it is TRUE, the item is scrolled until it is at least partially visible.

Return Value

If an error occurs, the return value is $LB_ERR.

Remarks

DOES NOT WORK WITH SINGLE-SELECTION LIST BOXES

Related

_GUICtrlListGetTopIndex, _GUICtrlListGetAnchorIndex

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $label, $button

GUICreate("ListBox Set Caret Index Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
$button = GUICtrlCreateButton("Set Index", 150, 160, 120, 40)
$label = GUICtrlCreateLabel("Item #", 150, 210, 120)
$ret = _GUICtrlListGetCaretIndex ($listbox)
GUICtrlSetData($label, "Item : " & $ret)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListSetCaretIndex ($listbox, 3, 1)
$ret = _GUICtrlListGetCaretIndex ($listbox)
GUICtrlSetData($label, "Item : " & $ret)
EndSelect
WEnd


Function _GUICtrlListSetHorizontalExtent

Function Reference

_GUICtrlListSetHorizontalExtent

Set the width, in pixels, by which a list box can be scrolled horizontally

#Include <GuiList.au3>
_GUICtrlListSetHorizontalExtent($h_listbox)

Parameters

$h_listbox | control id/control hWnd
$i_pixels | Specifies the number of pixels by which the list box can be scrolled.

Return Value

None.

Remarks

The list box must have been defined with the $WS_HSCROLL style.

Related

_GUICtrlListGetHorizontalExtent

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $listbox, $label

GUICreate("ListBox Set Horizontal Extent", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 100, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_DISABLENOSCROLL, $WS_HSCROLL))
_GUICtrlListSetHorizontalExtent ($listbox, 120)
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|")
$label = GUICtrlCreateLabel("HorizontalExtent: " & _GUICtrlListGetHorizontalExtent ($listbox), 150, 210, 120)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlListSetLocale

Function Reference

_GUICtrlListSetLocale

Set the locale

#Include <GuiList.au3>
_GUICtrlListSetLocale($h_listbox, $s_locale)

Parameters

$h_listbox | control id/control hWnd
$s_locale | Locale

Return Value

Returns previous locale or $LB_ERR

Remarks

"0409" for U.S. English
see @OSLang for string values

Related

_GUICtrlListGetLocale

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt('MustDeclareVars',1)

Dim $msg, $ret,$listbox,$button,$button2

GUICreate("ListBox Get Locale Demo",400,250,-1,-1)
$listbox = GUICtrlCreateList("",125,40,180,120)
GUICtrlSetData($listbox,"test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
$button = GUICtrlCreateButton('Set Locale English',85,160,120,40)
$button2 = GUICtrlCreateButton('Set Locale Spanish',210,160,120,40)

GUISetState ()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListSetLocale($listbox,"0409") ; U.S. English
If($ret == $LB_ERR) Then
MsgBox(16,"Error","Unknown error from _GUICtrlListSetLocale")
Else
MsgBox(0,"Previous Locale",$ret)
EndIf
Case $msg = $button2
$ret = _GUICtrlListSetLocale($listbox,"040a") ;Spanish_Traditional_Sort
If($ret == $LB_ERR) Then
MsgBox(16,"Error","Unknown error from _GUICtrlListSetLocale")
Else
MsgBox(0,"Previous Locale",$ret)
EndIf
EndSelect
Wend


Function _GUICtrlListSetSel

Function Reference

_GUICtrlListSetSel

Select string(s) in a multiple-selection list box

#Include <GuiList.au3>
_GUICtrlListSetSel($h_listbox[, $i_flag=-1[, $i_index = -1]])

Parameters

$h_listbox | control id/control hWnd
$i_flag | Optional: Select/UnSelect
$i_index | Optional: Specifies the zero-based index of the item

Return Value

If an error occurs, the return value is $LB_ERR

Remarks

DOES NOT WORK WITH SINGLE-SELECTION LIST BOXES
$i_flag == 0 means unselect
$i_flag == 1 means select
$i_flag == -1 means toggle select/unselect of item
An $i_index of -1 means to toggle select/unselect of all items (ignores the $i_flag).

Related

_GUICtrlListSelectString, _GUICtrlListGetSelState, _GUICtrlListGetSelCount, _GUICtrlListGetSelItems, _GUICtrlListSelItemRange, _GUICtrlListSelItemRangeEx

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt('MustDeclareVars',1)

Dim $msg, $ret
Dim $listbox,$button,$i,$button2,$button3

GUICreate("ListBox Set Selection(s) Demo",400,250,-1,-1)

$listbox = GUICtrlCreateList("",125,40,180,120,BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY,$LBS_MULTIPLESEL))
GUICtrlSetData($listbox,"test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
$button = GUICtrlCreateButton("Toggle All",85,160,120,40)
$button2 = GUICtrlCreateButton("Set index 3",215,160,120,40)
$button3 = GUICtrlCreateButton("Toggle index 3",150,210,120,40)

GUISetState ()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListSetSel($listbox)
If($ret == $LB_ERR) Then
MsgBox(16,"Error","Unknown error from _GUICtrlListSetSel")
EndIf
Case $msg = $button2
$ret = _GUICtrlListSetSel($listbox,1,3)
If($ret == $LB_ERR) Then
MsgBox(16,"Error","Unknown error from _GUICtrlListSetSel")
EndIf
Case $msg = $button3
$ret = _GUICtrlListSetSel($listbox,-1,3)
If($ret == $LB_ERR) Then
MsgBox(16,"Error","Unknown error from _GUICtrlListSetSel")
EndIf
EndSelect
Wend


Function _GUICtrlListSetTopIndex

Function Reference

_GUICtrlListSetTopIndex

Ensure that a particular item in a list box is visible

#Include <GuiList.au3>
_GUICtrlListSetTopIndex($h_listbox, $i_index)

Parameters

$h_listbox | control id/control hWnd
$i_index | Specifies the zero-based index of the item

Return Value

If an error occurs, the return value is $LB_ERR

Remarks

None.

Related

_GUICtrlListGetTopIndex

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt('MustDeclareVars',1)

Dim $msg, $ret
Dim $listbox,$button,$i

GUICreate("ListBox Set Top Index Demo",400,250,-1,-1)

$listbox = GUICtrlCreateList("",125,40,180,120)
GUICtrlSetData($listbox,"test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
$button = GUICtrlCreateButton("Set Top Index to 4",150,160,120,40)

GUISetState ()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListSetTopIndex($listbox,4)
If($ret == $LB_ERR) Then
MsgBox(16,"Error","Unknown error from _GUICtrlListSetTopIndex")
EndIf
EndSelect
Wend


Function _GUICtrlListSort

Function Reference

_GUICtrlListSort

Re-sorts list box if it has the $LBS_SORT style

#Include <GuiList.au3>
_GUICtrlListSort($h_listbox)

Parameters

$h_listbox control id/control hWnd

Return Value

If an error occurs, the return value is $LB_ERR

Remarks

Re-sorts list box if it has the $LBS_SORT style
Might be useful if you use InsertString

Related

None.

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt('MustDeclareVars',1)

Dim $msg, $ret,$listbox,$button

GUICreate("ListBox Sort Demo",400,250,-1,-1)

$listbox = GUICtrlCreateList("",125,40,180,120,BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY,$LBS_MULTIPLESEL))
GUICtrlSetData($listbox,"test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
$button = GUICtrlCreateButton('Sort',150,160,120,40)

GUISetState ()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListSort($listbox)
If($ret == $LB_ERR) Then
MsgBox(16,"Error","Unknown error from _GUICtrlListBoxSort")
EndIf
EndSelect
Wend


Function _GUICtrlListSwapString

Function Reference

_GUICtrlListSwapString

Swaps the text of two items at the specified indices

#Include <GuiList.au3>
_GUICtrlListSwapString($h_listbox, $i_indexA, $i_indexB)

Parameters

$h_listbox | control id/control hWnd
$i_indexA | Zero-based index item to swap
$i_indexB | Zero-based index item to swap

Return Value

If an error occurs, the return value is $LB_ERR

Remarks

None.

Related

None.

Example

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt('MustDeclareVars',1)

Dim $msg, $ret,$listbox,$button

GUICreate("ListBox Swap String Demo",400,250,-1,-1)

$listbox = GUICtrlCreateList("",125,40,180,120,BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY,$LBS_MULTIPLESEL))
GUICtrlSetData($listbox,"test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
$button = GUICtrlCreateButton('Swap Strings on Indexes 3,5',140,160,150,40)

GUISetState ()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListSwapString($listbox,3,5)
If($ret == $LB_ERR) Then
MsgBox(16,"Error","Unknown error from _GUICtrlListSwapString")
EndIf
EndSelect
Wend


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: GuiListView Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_GUICtrlListViewCopyItems | Copy Items between 2 list-view controls
_GUICtrlListViewDeleteAllItems | Removes all items from a list-view control
_GUICtrlListViewDeleteColumn | Removes a column from a list-view control
_GUICtrlListViewDeleteItem | Removes an item from a list-view control
_GUICtrlListViewDeleteItemsSelected | Deletes item(s) selected
_GUICtrlListViewEnsureVisible | Ensures that a list-view item is either entirely or partially visible
_GUICtrlListViewGetBackColor | Retrieves the background color of a list-view control
_GUICtrlListViewGetCallBackMask | Retrieves the callback mask for a list-view control
_GUICtrlListViewGetCheckedState | Returns the check state for a list-view control item
_GUICtrlListViewGetColumnOrder | Retrieves the current left-to-right order of columns in a list-view control.
_GUICtrlListViewGetColumnWidth | Retrieves the width of a column in report or list view
_GUICtrlListViewGetCounterPage | Calculates the number of items that can fit vertically in the visible area of a list-view control
_GUICtrlListViewGetCurSel | Retrieve the index of current selection
_GUICtrlListViewGetExtendedListViewStyle | Retrieves the extended styles that are currently in use for a given list-view control
_GUICtrlListViewGetHeader | Retrieves the handle to the header control used by the list-view control
_GUICtrlListViewGetHotCursor | Retrieves the HCURSOR value used when the pointer is over an item while hot tracking is enabled
_GUICtrlListViewGetHotItem | Retrieves the index of the hot item
_GUICtrlListViewGetHoverTime | Retrieves the amount of time that the mouse cursor must hover over an item before it is selected
_GUICtrlListViewGetItemCount | Retrieves the number of items in a list-view control
_GUICtrlListViewGetItemText | Retrieves some or all of a list-view item
_GUICtrlListViewGetItemTextArray | Retrieves all of a list-view item
_GUICtrlListViewGetNextItem | Returns the index of the next item
_GUICtrlListViewGetSelectedCount | Determines the number of selected items in a list-view control
_GUICtrlListViewGetSelectedIndices | Retrieve indices of selected item(s) in a list-view control
_GUICtrlListViewGetSubItemsCount | Retrieve the number of columns
_GUICtrlListViewGetTopIndex | Retrieves the index of the topmost visible item when in list or report view
_GUICtrlListViewGetUnicodeFormat | Retrieves the UNICODE character format flag for the control
_GUICtrlListViewHideColumn | Hides the column "sets column width to zero"
_GUICtrlListViewInsertColumn | Inserts a column into a list-view control
_GUICtrlListViewInsertItem | Inserts a new item in a list-view control.
_GUICtrlListViewJustifyColumn | Set Justification of a column for a list-view control
_GUICtrlListViewScroll | Scrolls the content of a list-view control
_GUICtrlListViewSetCheckState | Sets the checked state of a list-view control item
_GUICtrlListViewSetColumnHeaderText | Change the text of a column header for a list-view control
_GUICtrlListViewSetColumnOrder | Sets the left-to-right order of columns in a list-view control.
_GUICtrlListViewSetColumnWidth | Changes the width of a column
_GUICtrlListViewSetHotItem | Sets the hot item for a list-view control
_GUICtrlListViewSetHoverTime | Sets the amount of time which the mouse cursor must hover over an item before it is selected
_GUICtrlListViewSetItemCount | Causes the list-view control to allocate memory for the specified number of items.
_GUICtrlListViewSetItemSelState | Sets the Item Selected/UnSelected
_GUICtrlListViewSetItemText | Changes the text of a list-view item or subitem.
_GUICtrlListViewSort | Sorts a list-view control.


Function _GUICtrlListViewCopyItems

Function Reference

_GUICtrlListViewCopyItems

Copy Items between 2 list-view controls

#Include <GuiListView.au3>
_GUICtrlListViewCopyItems($h_Source_listview, $h_Destination_listview[, $i_DelFlag = 0])

Parameters

$h_Source_listview | control id/control hWnd
$h_Destination_listview | control id/control hWnd
$i_DelFlag | Optional: Delete after copying (Default: 0)

Return Value

None

Remarks

This will work with/with-out checkboxes in the list-view control

Related

_GUICtrlListViewDeleteAllItems, _GUICtrlListViewDeleteItem, _GUICtrlListViewDeleteItemsSelected

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ("GUIOnEventMode", 1)
Opt ('MustDeclareVars', 1)

Dim $listview, $listview2, $Btn_MoveLeft, $Btn_MoveRight, $Btn_Exit1, $Btn_Exit2, $msg, $GUI1, $GUI2
Dim $Btn_CopyRight, $Btn_CopyLeft
Dim $OptionsMenu, $OptionsItem1, $OptionsItem2, $separator1, $OptionsItem3, $OptionsItem4
Dim $Dock = 1, $Dock_Location = 1, $x1, $x2, $y1, $y2

$GUI1 = GUICreate("GuiListView Copy Items", 300, 220, 10, 10)
$OptionsMenu = GUICtrlCreateMenu("Options")
$OptionsItem1 = GUICtrlCreateMenu("Docking", $OptionsMenu)

$OptionsItem2 = GUICtrlCreateMenuItem("Docked", $OptionsItem1)
$separator1 = GUICtrlCreateMenuItem("", $OptionsItem1)
$OptionsItem3 = GUICtrlCreateMenuItem("Side By Side", $OptionsItem1)
$OptionsItem4 = GUICtrlCreateMenuItem("Top And Bottom", $OptionsItem1)
GUICtrlSetState($OptionsItem2, $GUI_CHECKED)
GUICtrlSetState($OptionsItem3, $GUI_CHECKED)
GUICtrlSetOnEvent($OptionsItem2, "_SetDocking")
GUICtrlSetOnEvent($OptionsItem3, "_SetDockSideBySide")
GUICtrlSetOnEvent($OptionsItem4, "_SetDockTopAndBottom")

GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")

$listview = GUICtrlCreateListView("col1|col2|col3", 5, 5, 150, 185, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListViewSetColumnWidth ($listview, 0, 60)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_CHECKBOXES, $LVS_EX_CHECKBOXES)

$Btn_MoveRight = GUICtrlCreateButton("Move", 175, 35, 90, 20)
GUICtrlSetOnEvent($Btn_MoveRight, "_MoveRight")

$Btn_CopyRight = GUICtrlCreateButton("Copy", 175, 60, 90, 20)
GUICtrlSetOnEvent($Btn_CopyRight, "_CopyRight")

$Btn_Exit1 = GUICtrlCreateButton("Exit", 175, 140, 90, 25)
GUICtrlSetOnEvent($Btn_Exit1, "_Exit")

$GUI2 = GUICreate("Right/Bottom Window", 300, 220, 315, 10)

GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")

$Btn_MoveLeft = GUICtrlCreateButton("Move", 175, 55, 90, 20)
GUICtrlSetOnEvent($Btn_MoveLeft, "_MoveLeft")

$Btn_CopyLeft = GUICtrlCreateButton("Copy", 175, 80, 90, 20)
GUICtrlSetOnEvent($Btn_CopyLeft, "_CopyLeft")

$Btn_Exit2 = GUICtrlCreateButton("Exit", 175, 160, 90, 25)
GUICtrlSetOnEvent($Btn_Exit2, "_Exit")

$listview2 = GUICtrlCreateListView("col1|col2|col3", 5, 25, 150, 185, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListViewSetColumnWidth ($listview2, 0, 60)
GUICtrlSendMsg($listview2, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview2, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview2, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_CHECKBOXES, $LVS_EX_CHECKBOXES)

GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)

GUISetState(@SW_SHOW, $GUI2)
GUISetState(@SW_SHOW, $GUI1)

While 1
If $Dock Then _KeepWindowsDocked()
Sleep(10)
WEnd

Func _SetDocking()
If BitAND(GUICtrlRead($OptionsItem2), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($OptionsItem2, $GUI_UNCHECKED)
$Dock = 0
Else
GUICtrlSetState($OptionsItem2, $GUI_CHECKED)
$Dock = 2
EndIf
If $Dock Then _KeepWindowsDocked()
EndFunc ;==>_SetDocking

Func _SetDockSideBySide()
If BitAND(GUICtrlRead($OptionsItem3), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($OptionsItem3, $GUI_UNCHECKED)
GUICtrlSetState($OptionsItem4, $GUI_CHECKED)
$Dock_Location = 2
Else
GUICtrlSetState($OptionsItem3, $GUI_CHECKED)
GUICtrlSetState($OptionsItem4, $GUI_UNCHECKED)
$Dock_Location = 1
If $Dock Then $Dock = 2
EndIf
If $Dock Then _KeepWindowsDocked()
EndFunc ;==>_SetDockSideBySide

Func _SetDockTopAndBottom()
If BitAND(GUICtrlRead($OptionsItem4), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($OptionsItem4, $GUI_UNCHECKED)
GUICtrlSetState($OptionsItem3, $GUI_CHECKED)
$Dock_Location = 1
Else
GUICtrlSetState($OptionsItem4, $GUI_CHECKED)
GUICtrlSetState($OptionsItem3, $GUI_UNCHECKED)
$Dock_Location = 2
If $Dock Then $Dock = 2
EndIf
If $Dock Then _KeepWindowsDocked()
EndFunc ;==>_SetDockTopAndBottom

Func _KeepWindowsDocked()
Local $p_win1 = WinGetPos($GUI1)
Local $p_win2 = WinGetPos($GUI2)
If $Dock_Location == 1 Then
If (($p_win1[0] <> $x1 Or $p_win1[1] <> $y1) And BitAND(WinGetState($GUI1), 8) Or $Dock = 2) Then
$x1 = $p_win1[0]
$y1 = $p_win1[1]
$x2 = $p_win1[2] + $x1
$y2 = $y1
WinMove($GUI2, "", $x2, $y2)
$Dock = 1
ElseIf (($p_win2[0] <> $x2 Or $p_win2[1] <> $y2) And BitAND(WinGetState($GUI2), 8)) Then
$x2 = $p_win2[0]
$y2 = $p_win2[1]
$x1 = $p_win2[0] - $p_win1[2]
$y1 = $y2
WinMove($GUI1, "", $x1, $y1)
EndIf
Else
If (($p_win1[0] <> $x1 Or $p_win1[1] <> $y1) And BitAND(WinGetState($GUI1), 8) Or $Dock = 2) Then
$x1 = $p_win1[0]
$y1 = $p_win1[1]
$x2 = $x1
$y2 = $p_win1[3] + $y1
WinMove($GUI2, "", $x2, $y2)
$Dock = 1
ElseIf (($p_win2[0] <> $x2 Or $p_win2[1] <> $y2) And BitAND(WinGetState($GUI2), 8)) Then
$x2 = $p_win2[0]
$y2 = $p_win2[1]
$x1 = $x2
$y1 = $p_win2[1] - $p_win1[3]
WinMove($GUI1, "", $x1, $y1)
EndIf
EndIf
EndFunc ;==>_KeepWindowsDocked

Func _CopyRight()
_GUICtrlListViewCopyItems ($listview, $listview2)
EndFunc ;==>_CopyRight

Func _MoveRight()
_GUICtrlListViewCopyItems ($listview, $listview2, 1)
EndFunc ;==>_MoveRight

Func _CopyLeft()
_GUICtrlListViewCopyItems ($listview2, $listview)
EndFunc ;==>_CopyLeft

Func _MoveLeft()
_GUICtrlListViewCopyItems ($listview2, $listview, 1)
EndFunc ;==>_MoveLeft

Func _Exit()
Exit
EndFunc ;==>_Exit

Func SpecialEvents()
Select
Case @GUI_CtrlId = $GUI_EVENT_CLOSE
Exit
EndSelect
EndFunc ;==>SpecialEvents


Function _GUICtrlListViewDeleteAllItems

Function Reference

_GUICtrlListViewDeleteAllItems

Removes all items from a list-view control

#Include <GuiListView.au3>
_GUICtrlListViewDeleteAllItems($h_listview)

Parameters

$h_listview control id/control hWnd

Return Value

Returns TRUE if successful, or FALSE otherwise

Remarks

Related

_GUICtrlListViewDeleteItem, _GUICtrlListViewDeleteItemsSelected, _GUICtrlListViewDeleteColumn

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_DeleteAll, $Btn_Exit, $msg, $ret, $Status
GUICreate("ListView Delete All Items", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_DeleteAll = GUICtrlCreateButton("Delete All Items", 150, 200, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_DeleteAll
If (_GUICtrlListViewDeleteAllItems ($listview)) Then
GUICtrlSetData($Status, 'Deleted All Items')
Else
GUICtrlSetData($Status, 'Delete Failed')
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewDeleteColumn

Function Reference

_GUICtrlListViewDeleteColumn

Removes a column from a list-view control

#Include <GuiListView.au3>
_GUICtrlListViewDeleteColumn($h_listview, $i_col)

Parameters

$h_listview | control id/control hWnd
$i_col | Index of the column to delete

Return Value

Returns TRUE if successful, or FALSE otherwise

Remarks

Column zero of the list-view control cannot be deleted.
If you must delete column zero, insert a zero length dummy
column zero and delete column one and above

Related

_GUICtrlListViewDeleteAllItems, _GUICtrlListViewDeleteItem, _GUICtrlListViewDeleteItemsSelected, _GUICtrlListViewGetSubItemsCount

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_DeleteCol, $Btn_Exit, $msg, $Input_col, $Status
GUICreate("ListView Delete Column", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
GUICtrlCreateLabel("Enter Column # to Delete:", 90, 190, 130, 20)
$Input_col = GUICtrlCreateInput("", 220, 190, 80, 20, $ES_NUMBER)
GUICtrlSetLimit($Input_col, 1)
$Btn_DeleteCol = GUICtrlCreateButton("Delete Column", 150, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("Remember columns are zero-indexed", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_DeleteCol
If (StringLen(GUICtrlRead($Input_col)) > 0) Then
If (_GUICtrlListViewDeleteColumn ($listview, Int(GUICtrlRead($Input_col)))) Then
GUICtrlSetData($Status, 'Deleted column: ' & GUICtrlRead($Input_col) & ' Successful')
Else
GUICtrlSetData($Status, 'Failed to Delete column: ' & GUICtrlRead($Input_col))
EndIf
Else
GUICtrlSetData($Status, 'Must enter a column to delete')
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewDeleteItem

Function Reference

_GUICtrlListViewDeleteItem

Removes an item from a list-view control

#Include <GuiListView.au3>
_GUICtrlListViewDeleteItem($h_listview, $i_index)

Parameters

$h_listview | control id/control hWnd
$i_index | Index of the list-view item to delete

Return Value

Returns TRUE if successful, or FALSE otherwise

Remarks

None.

Related

_GUICtrlListViewDeleteAllItems, _GUICtrlListViewDeleteItemsSelected, _GUICtrlListViewDeleteColumn

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_DeleteItem, $Btn_Exit, $msg, $Input_item, $Status
GUICreate("ListView Delete Item", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
GUICtrlCreateLabel("Enter Item # to Delete:", 90, 190, 130, 20)
$Input_item = GUICtrlCreateInput("", 220, 190, 80, 20, $ES_NUMBER)
GUICtrlSetLimit($Input_item, 1)
$Btn_DeleteItem = GUICtrlCreateButton("Delete Item", 150, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("Remember items are zero-indexed", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_DeleteItem
If (StringLen(GUICtrlRead($Input_item)) > 0) Then
If (_GUICtrlListViewDeleteItem ($listview, Int(GUICtrlRead($Input_item)))) Then
GUICtrlSetData($Status, 'Delete item: ' & GUICtrlRead($Input_item) & ' Successful')
Else
GUICtrlSetData($Status, 'Failed to Delete item: ' & GUICtrlRead($Input_item))
EndIf
Else
GUICtrlSetData($Status, 'Must enter a item to delete')
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewDeleteItemsSelected

Function Reference

_GUICtrlListViewDeleteItemsSelected

Deletes item(s) selected

#Include <GuiListView.au3>
_GUICtrlListViewDeleteItemsSelected($h_listview)

Parameters

$h_listview control id/control hWnd

Return Value

None.

Remarks

None.

Related

_GUICtrlListViewDeleteAllItems, _GUICtrlListViewDeleteItem, _GUICtrlListViewDeleteColumn

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_DeleteItems, $Btn_Exit, $msg
GUICreate("ListView Delete Items Selected", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_DeleteItems = GUICtrlCreateButton("Delete Items Selected", 150, 230, 120, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_DeleteItems
_GUICtrlListViewDeleteItemsSelected ($listview)
EndSelect
WEnd
Exit


Function _GUICtrlListViewEnsureVisible

Function Reference

_GUICtrlListViewEnsureVisible

Ensures that a list-view item is either entirely or partially visible

#Include <GuiListView.au3>
_GUICtrlListViewEnsureVisible($h_listview, $i_index, $i_bool)

Parameters

$h_listview | control id/control hWnd
$i_index | Index of the list-view item
$i_bool | Value specifying whether the item must be entirely visible

Return Value

Returns TRUE if successful, or FALSE otherwise

Remarks

If $i_bool parameter is TRUE, no scrolling occurs if the item is at least partially visible

Related

None.

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $i, $Styles, $Btn_visible, $i
GUICreate("ListView Ensure Visible", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 144)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
For $i = 1 To 20
GUICtrlCreateListViewItem("line" & $i & "|data" & $i & "|more" & $i, $listview)
Next
$Btn_visible = GUICtrlCreateButton("Set Visible", 150, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_visible
_GUICtrlListViewEnsureVisible($listview, 12, 1)
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetBackColor

Function Reference

_GUICtrlListViewGetBackColor

Retrieves the background color of a list-view control

#Include <GuiListView.au3>
_GUICtrlListViewGetBackColor($h_listview)

Parameters

$h_listview control id/control hWnd

Return Value

Returns the Hex RGB background color of the list-view control

Remarks

None.

Related

None.

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status
GUICreate("ListView Get BackColor", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30)
$Status = GUICtrlCreateLabel("ListView BackColor: " & _GUICtrlListViewGetBackColor ($listview), 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetCallBackMask

Function Reference

_GUICtrlListViewGetCallBackMask

Retrieves the callback mask for a list-view control

#Include <GuiListView.au3>
_GUICtrlListViewGetCallBackMask($h_listview)

Parameters

$h_listview control id/control hWnd

Return Value

Returns the callback mask

Remarks

None.

Related

None.

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $pos
GUICreate("ListView Get CallBack Mask", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $GUI_EVENT_PRIMARYDOWN
$pos = GUIGetCursorInfo()
If ($pos[4] == $listview) Then
GUICtrlSetData($Status, "ListView Call Back Mask: " & _GUICtrlListViewGetCallBackMask ($listview))
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetCheckedState

Function Reference

_GUICtrlListViewGetCheckedState

Returns the check state for a list-view control item

#Include <GuiListView.au3>
_GUICtrlListViewGetCheckedState($h_listview, $i_index)

Parameters

$h_listview | control id/control hWnd
$i_index | zero-based index to retrieve item check state from

Return Value

Returns 1 if checked
Returns 0 if not checked
If error then $LV_ERR is returned

Remarks

Requires $LVS_EX_CHECKBOXES to be used in extended style when creating listview

Related

_GUICtrlListViewGetCurSel

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

opt('MustDeclareVars', 1)
Dim $listview, $Btn_Get, $Btn_Exit, $msg, $Status, $ret
GUICreate("ListView Get Checked State", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_CHECKBOXES, $LVS_EX_CHECKBOXES)
GUICtrlCreateListViewItem("index 0|data1|more1", $listview)
GUICtrlCreateListViewItem("index 1|data2|more2", $listview)
GUICtrlCreateListViewItem("index 2|data3|more3", $listview)
GUICtrlCreateListViewItem("index 3|data4|more4", $listview)
GUICtrlCreateListViewItem("index 4|data5|more5", $listview)
_GUICtrlListViewSetColumnWidth ($listview, 0, 100)
$Btn_Get = GUICtrlCreateButton("Get From Index 2", 150, 200, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Get
GUICtrlSetData($Status, "")
Local $is_Checked = _GUICtrlListViewGetCheckedState ($listview, 2)
If ($is_Checked <> $LV_ERR) Then
If ($is_Checked) Then
GUICtrlSetData($Status, "Item is Checked")
Else
GUICtrlSetData($Status, "Item not Checked")
EndIf
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetColumnOrder

Function Reference

_GUICtrlListViewGetColumnOrder

Retrieves the current left-to-right order of columns in a list-view control.

#Include <GuiListView.au3>
_GUICtrlListViewGetColumnOrder($h_listview)

Parameters

$h_listbox control id/control hWnd

Return Value

"|" delimited string
If an error occurs, the return value is $LV_ERR.

Remarks

None.

Related

_GUICtrlListViewGetSubItemsCount, _GUICtrlListViewSetColumnOrder

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

opt('MustDeclareVars', 1)

Dim $listview, $button, $msg, $i, $a_order

GUICreate("ListView Get Column Order", 392, 254)
$listview = GUICtrlCreateListView("col1|col2|col3|col4", 100, 10, 200, 100, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_HEADERDRAGDROP, $LVS_EX_HEADERDRAGDROP)
$button = GUICtrlCreateButton("Get Order", 150, 120, 90, 30)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$a_order = StringSplit(_GUICtrlListViewGetColumnOrder($listview),"|")
For $i = 1 To $a_order[0]
MsgBox(0, "col", $a_order[$i])
Next
EndSelect
WEnd


Function _GUICtrlListViewGetColumnWidth

Function Reference

_GUICtrlListViewGetColumnWidth

Retrieves the width of a column in report or list view

#Include <GuiListView.au3>
_GUICtrlListViewGetColumnWidth($h_listview, $i_col)

Parameters

$h_listview | control id/control hWnd
$i_col | Index of the column. This parameter is ignored in list view

Return Value

Returns the column width if successful, or zero otherwise

Remarks

If this message is sent to a list-view control with the $LVS_REPORT style
and the specified column doesn't exist, the return value is undefined

Related

_GUICtrlListViewHideColumn, _GUICtrlListViewSetColumnWidth, _GUICtrlListViewDeleteColumn

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $pos
GUICreate("ListView Get Column Width", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $GUI_EVENT_PRIMARYUP
GUICtrlSetData($Status, "col1 width: " & _GUICtrlListViewGetColumnWidth ($listview, 0) & ", col2 width: " & _GUICtrlListViewGetColumnWidth ($listview, 1) & ", col3 width: " & _GUICtrlListViewGetColumnWidth ($listview, 2))
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetCounterPage

Function Reference

_GUICtrlListViewGetCounterPage

Calculates the number of items that can fit vertically in the visible area of a list-view control

#Include <GuiListView.au3>
_GUICtrlListViewGetCounterPage($h_listview)

Parameters

$h_listview control id/control hWnd

Return Value

Returns the number of fully visible items if successful.

Remarks

None.

Related

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status
GUICreate("ListView Get Counter Page", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30)
$Status = GUICtrlCreateLabel("Possible Fully Visible Rows: " & _GUICtrlListViewGetCounterPage ($listview), 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetCurSel

Function Reference

_GUICtrlListViewGetCurSel

Retrieve the index of current selection

#Include <GuiListView.au3>
_GUICtrlListViewGetCurSel($h_listview)

Parameters

$h_listview control id/control hWnd

Return Value

Index of current selection (zero-based index)
Returns $LV_ERR if error

Remarks

None.

Related

_GUICtrlListViewGetSelectedCount, _GUICtrlListViewGetItemText, _GUICtrlListViewGetItemTextArray, _GUICtrlListViewGetNextItem

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $pos
GUICreate("ListView Get Current Selection", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $GUI_EVENT_PRIMARYDOWN
$pos = GUIGetCursorInfo()
If ($pos[4] == $listview) Then
GUICtrlSetData($Status, "Current Index Selected: " & _GUICtrlListViewGetCurSel ($listview))
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetExtendedListViewStyle

Function Reference

_GUICtrlListViewGetExtendedListViewStyle

Retrieves the extended styles that are currently in use for a given list-view control

#Include <GuiListView.au3>
_GUICtrlListViewGetExtendedListViewStyle($h_listview)

Parameters

$h_listview control id/control hWnd

Return Value

Returns a DWORD that represents the styles currently in use for a given list-view control.
This value can be a combination of Extended List-View Styles

Remarks

None.

Related

None.

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $i, $Styles, $Status, $Btn_Get, $i
GUICreate("ListView Get Extended List View Style", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_HEADERDRAGDROP, $LVS_EX_HEADERDRAGDROP)
For $i = 1 To 20
GUICtrlCreateListViewItem("line" & $i & "|data" & $i & "|more" & $i, $listview)
Next
$Btn_Get = GUICtrlCreateButton("Get Styles", 150, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("Extended List View Style(s): " & _GUICtrlListViewGetExtendedListViewStyle($listview), 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Get
For $i = 1 to 17
Select
Case $i = 1
If(BitAND(_GUICtrlListViewGetExtendedListViewStyle($listview),$LVS_EX_CHECKBOXES) = $LVS_EX_CHECKBOXES) Then
$Styles &= "$LVS_EX_CHECKBOXES" & @LF
EndIf
Case $i = 2
If(BitAND(_GUICtrlListViewGetExtendedListViewStyle($listview),$LVS_EX_GRIDLINES) = $LVS_EX_GRIDLINES) Then
$Styles &= "$LVS_EX_GRIDLINES" & @LF
EndIf
Case $i = 4
If(BitAND(_GUICtrlListViewGetExtendedListViewStyle($listview),$LVS_EX_HEADERDRAGDROP) = $LVS_EX_HEADERDRAGDROP) Then
$Styles &= "$LVS_EX_HEADERDRAGDROP"
EndIf
EndSelect
Next
If($Styles) Then
MsgBox(0,"Extend Styles found", $Styles)
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetHeader

Function Reference

_GUICtrlListViewGetHeader

Retrieves the handle to the header control used by the list-view control

#Include <GuiListView.au3>
_GUICtrlListViewGetHeader($h_listview)

Parameters

$h_listview control id/control hWnd

Return Value

Returns the handle to the header control.

Remarks

A list-view control uses hot tracking and hover selection when
the $LVS_EX_TRACKSELECT style is set.

Related

None.

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status
GUICreate("ListView Edit Lable", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("HeaderID: " & _GUICtrlListViewGetHeader($listview), 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetHotCursor

Function Reference

_GUICtrlListViewGetHotCursor

Retrieves the HCURSOR value used when the pointer is over an item while hot tracking is enabled

#Include <GuiListView.au3>
_GUICtrlListViewGetHotCursor($h_listview)

Parameters

$h_listview control id/control hWnd

Return Value

Returns an HCURSOR value that is the handle to the cursor that
the list-view control uses when hot tracking is enabled.

Remarks

A list-view control uses hot tracking and hover selection when
the $LVS_EX_TRACKSELECT style is set.

Related

None.

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status
GUICreate("ListView Get Hot Cursor", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 144)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_HEADERDRAGDROP, $LVS_EX_HEADERDRAGDROP)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_TRACKSELECT, $LVS_EX_TRACKSELECT)
For $i = 1 To 20
GUICtrlCreateListViewItem("line" & $i & "|data" & $i & "|more" & $i, $listview)
Next
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("Hot Cursor: " & _GUICtrlListViewGetHotCursor($listview), 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetHotItem

Function Reference

_GUICtrlListViewGetHotItem

Retrieves the index of the hot item

#Include <GuiListView.au3>
_GUICtrlListViewGetHotItem($h_listview)

Parameters

$h_listview control id/control hWnd

Return Value

Returns the index of the item that is hot.

Remarks

None.

Related

_GUICtrlListViewSetHotItem, _GUICtrlListViewGetHoverTime, _GUICtrlListViewSetHoverTime

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $pos, $current
GUICreate("ListView Get Hot Item", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_TRACKSELECT, $LVS_EX_TRACKSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
$current = _GUICtrlListViewGetHotItem ($listview)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case Else
$pos = GUIGetCursorInfo()
If ($pos[4] == $listview) Then
If ($current <> _GUICtrlListViewGetHotItem ($listview) And _GUICtrlListViewGetHotItem ($listview) >= 0) Then
GUICtrlSetData($Status, "Hot Item: " & _GUICtrlListViewGetHotItem ($listview))
$current = _GUICtrlListViewGetHotItem ($listview)
ElseIf (_GUICtrlListViewGetHotItem ($listview) == -1) Then
GUICtrlSetData($Status, "")
EndIf
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetHoverTime

Function Reference

_GUICtrlListViewGetHoverTime

Retrieves the amount of time that the mouse cursor must hover over an item before it is selected

#Include <GuiListView.au3>
_GUICtrlListViewGetHoverTime($h_listview)

Parameters

$h_listview control id/control hWnd

Return Value

Returns the amount of time, in milliseconds.

Remarks

If the return value is -1, then the hover
time is the default hover time.

The hover time only affects list-view controls that have the
$LVS_EX_TRACKSELECT, $LVS_EX_ONECLICKACTIVATE, or
$LVS_EX_TWOCLICKACTIVATE extended list-view style.

Related

_GUICtrlListViewSetHoverTime, _GUICtrlListViewGetHotItem

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status
GUICreate("ListView Get Hover Time", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_TRACKSELECT, $LVS_EX_TRACKSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30)
$Status = GUICtrlCreateLabel("Hover Time:" & _GUICtrlListViewGetHoverTime ($listview), 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetItemCount

Function Reference

_GUICtrlListViewGetItemCount

Retrieves the number of items in a list-view control

#Include <GuiListView.au3>
_GUICtrlListViewGetItemCount($h_listview)

Parameters

$h_listview control id/control hWnd

Return Value

Returns the number of items.

Remarks

None.

Related

_GUICtrlListViewGetItemText, _GUICtrlListViewGetItemTextArray

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status
GUICreate("ListView Get Item Count", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_TRACKSELECT, $LVS_EX_TRACKSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30)
$Status = GUICtrlCreateLabel("Item Count: " & _GUICtrlListViewGetItemCount ($listview), 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetItemText

Function Reference

_GUICtrlListViewGetItemText

Retrieves some or all of a list-view item

#Include <GuiListView.au3>
_GUICtrlListViewGetItemText($h_listview[, $i_Item=-1[, $i_SubItem=-1]])

Parameters

$h_listview | control id/control hWnd
$i_Item | Index of item to retrieve from (zero-based index)
$i_SubItem | Optional: Column of item to retrieve from (zero-based index)

Return Value

If $i_Item = -1 then current selected index is used
If $i_SubItem = -1 then row is returned pipe delimited
else text from $i_SubItem position is returned
If error then @error is set to $LV_ERR and "" is returned

Remarks

None.

Related

_GUICtrlListViewGetItemTextArray, _GUICtrlListViewGetCurSel, _GUICtrlListViewGetSelectedCount

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Get, $Btn_GetSelected, $Btn_Exit, $msg, $Status, $ret
GUICreate("ListView Get Item Text", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Get = GUICtrlCreateButton("Get From Index 2", 75, 200, 90, 40)
$Btn_GetSelected = GUICtrlCreateButton("Get Selected", 200, 200, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Get
GUICtrlSetData($Status, "")
MsgBox(0, "Passed Item Index only", _GUICtrlListViewGetItemText ($listview, 2))
MsgBox(0, "Passed Item Index, SubItem 0", _GUICtrlListViewGetItemText ($listview, 2, 0))
Case $msg = $Btn_GetSelected
GUICtrlSetData($Status, "")
$ret = _GUICtrlListViewGetItemText ($listview)
If ($ret <> $LV_ERR) Then
MsgBox(0, "Selected Item", $ret)
$ret = _GUICtrlListViewGetItemText ($listview, -1, 0)
If ($ret <> $LV_ERR) Then
MsgBox(0, "Selected Item, SubItem 0", $ret)
EndIf
Else
GUICtrlSetData($Status, "Nothing Selected")
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetItemTextArray

Function Reference

_GUICtrlListViewGetItemTextArray

Retrieves all of a list-view item

#Include <GuiListView.au3>
_GUICtrlListViewGetItemTextArray($h_listview[, $i_Item=-1])

Parameters

$h_listview | control id/control hWnd
$i_Item | index of item to retrieve from (zero-based index)

Return Value

If $i_Item = -1 then current selected index is used
Returns an array of the subitems
If error $LV_ERR is returned

Remarks

Related

_GUICtrlListViewGetItemText, _GUICtrlListViewGetCurSel, _GUICtrlListViewGetSelectedCount

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Get, $Btn_GetSelected, $Btn_Exit, $msg, $Status, $a_Item, $i
GUICreate("ListView Get Item Text Array", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Get = GUICtrlCreateButton("Get From Index 2", 75, 200, 90, 40)
$Btn_GetSelected = GUICtrlCreateButton("Get Selected", 200, 200, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Get
GUICtrlSetData($Status, "")
$a_Item = _GUICtrlListViewGetItemTextArray ($listview, 2)
If (Not IsArray($a_Item)) Then
GUICtrlSetData($Status, "Invalid Item #")
Else
For $i = 1 To $a_Item[0]
MsgBox(0, "Passed Item Index only", "SubItem[" & $i & "] = " & $a_Item[$i])
Next
EndIf
Case $msg = $Btn_GetSelected
GUICtrlSetData($Status, "")
$a_Item = _GUICtrlListViewGetItemTextArray ($listview)
If (Not IsArray($a_Item)) Then
GUICtrlSetData($Status, "Nothing Selected")
Else
For $i = 1 To $a_Item[0]
MsgBox(0, "Passed Item Index only", "SubItem[" & $i & "] = " & $a_Item[$i])
Next
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetNextItem

Function Reference

_GUICtrlListViewGetNextItem

Returns the index of the next item

#Include <GuiListView.au3>
_GUICtrlListViewGetNextItem($h_GUI, $h_listview[, $i_index=-1[, $i_direction=0x0]])

Parameters

$h_GUI | GUI windows Handle
$h_listview | control id/control hWnd
$i_index | Optional: Index of the item to begin the search with (default -1)
$i_direction | Optional: Specifies the relationship to the item specified in $i_index (default $LVNI_ALL)

Return Value

Returns the index of the next item if successful, or $LV_ERR otherwise.

Remarks

If $i_index = -1 then find the first item that matches the specified $i_direction.
The specified item itself is excluded from the search.
$i_direction
Searches by index.
$LVNI_ALL Searches for a subsequent item by index, the default value.

Searches by physical relationship to the index of the item where the search is to begin.
$LVNI_ABOVE | Searches for an item that is above the specified item.
$LVNI_BELOW | Searches for an item that is below the specified item.
$LVNI_TOLEFT | Searches for an item to the left of the specified item.
$LVNI_TORIGHT | Searches for an item to the right of the specified item.

Related

_GUICtrlListViewGetItemText, _GUICtrlListViewGetItemTextArray

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_GetAbove, $Btn_GetBelow, $Btn_Exit, $msg, $Status, $GUI
$GUI = GUICreate("ListView Get Next Item", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_GetAbove = GUICtrlCreateButton("Get Next Above", 75, 200, 90, 40)
$Btn_GetBelow = GUICtrlCreateButton("Get Next Below", 200, 200, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_GetAbove
GUICtrlSetData($Status, "")
If (_GUICtrlListViewGetCurSel ($listview) > 0) Then
GUICtrlSetData($Status, "Next Above Index: " & _GUICtrlListViewGetNextItem ($GUI, $listview, _GUICtrlListViewGetCurSel ($listview), $LVNI_ABOVE))
Else
GUICtrlSetData($Status, "Nothing Selected or Nothing Above")
EndIf
Case $msg = $Btn_GetBelow
GUICtrlSetData($Status, "")
If (_GUICtrlListViewGetCurSel ($listview) > $LV_ERR And _GUICtrlListViewGetCurSel ($listview) < _GUICtrlListViewGetItemCount ($listview) -1) Then
GUICtrlSetData($Status, "Next Below Index: " & _GUICtrlListViewGetNextItem ($GUI, $listview, _GUICtrlListViewGetCurSel ($listview), $LVNI_BELOW))
Else
GUICtrlSetData($Status, "Nothing Selected or Nothing Below")
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetSelectedCount

Function Reference

_GUICtrlListViewGetSelectedCount

Determines the number of selected items in a list-view control

#Include <GuiListView.au3>
_GUICtrlListViewGetSelectedCount($h_listview)

Parameters

$h_listview control id/control hWnd

Return Value

Returns the number of selected items

Remarks

None.

Related

_GUICtrlListViewGetItemText, _GUICtrlListViewGetItemTextArray, _GUICtrlListViewGetNextItem

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $pos
GUICreate("ListView Get Selected Count", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $GUI_EVENT_PRIMARYDOWN
$pos = GUIGetCursorInfo()
If ($pos[4] == $listview) Then
GUICtrlSetData($Status, "Selected Count: " & _GUICtrlListViewGetSelectedCount ($listview))
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetSelectedIndices

Function Reference

_GUICtrlListViewGetSelectedIndices

Retrieve indices of selected item(s) in a list-view control

#Include <GuiListView.au3>
_GUICtrlListViewGetSelectedIndices($h_listview[, $i_ReturnType=0]))

Parameters

$h_listview | control id/control hWnd
$i_ReturnType | Optional: return a string or array

Return Value

If $i_ReturnType = 0 then Return pipe delimited string of indices of selected item(s)
If $i_ReturnType = 1 then Return array of indices of selected item(s)
If no items selected return $LV_ERR

Remarks

None.

Related

_GUICtrlListViewGetCurSel, _GUICtrlListViewGetSelectedCount

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $Btn_piped, $Btn_array
GUICreate("ListView Get Selected Indices", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_piped = GUICtrlCreateButton("Return string", 75, 210, 90, 30)
$Btn_array = GUICtrlCreateButton("Return array", 180, 210, 90, 30)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_piped
Local $s_indices = _GUICtrlListViewGetSelectedIndices($listview)
If($s_indices == $LV_ERR) Then
GUICtrlSetData($Status, "Not Items Selected")
Else
MsgBox(0,"Selected", $s_indices)
EndIf
Case $msg = $Btn_array
Local $a_indices = _GUICtrlListViewGetSelectedIndices($listview,1)
If(IsArray($a_indices))Then
Local $i
For $i = 1 To $a_indices[0]
MsgBox(0,"Selected", $a_indices[$i])
Next
Else
GUICtrlSetData($Status, "Not Items Selected")
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetSubItemsCount

Function Reference

_GUICtrlListViewGetSubItemsCount

Retrieve the number of columns

#Include <GuiListView.au3>
_GUICtrlListViewGetSubItemsCount( $h_listview )

Parameters

$h_listview control id/control hWnd

Return Value

Number of columns

Remarks

None.

Related

_GUICtrlListViewGetItemText, _GUICtrlListViewDeleteColumn, _GUICtrlListViewHideColumn

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $Btn_count
GUICreate("ListView Get SubItems Count", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_count = GUICtrlCreateButton("Count SubItems", 150, 210, 90, 30)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 90, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_count
GUICtrlSetData($Status, "SubItems: " & _GUICtrlListViewGetSubItemsCount($listview))
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetTopIndex

Function Reference

_GUICtrlListViewGetTopIndex

Retrieves the index of the topmost visible item when in list or report view

#Include <GuiListView.au3>
_GUICtrlListViewGetTopIndex($h_listview)

Parameters

$h_listview control id/control hWnd

Return Value

Returns the index of the item if successful

Remarks

None.

Related

_GUICtrlListViewGetItemText, _GUICtrlListViewGetItemTextArray

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_GetTop, $Btn_Exit, $msg, $Status
GUICreate("ListView Get Top Index", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
GUICtrlCreateListViewItem("line6|data6|more6", $listview)
GUICtrlCreateListViewItem("line7|data7|more7", $listview)
GUICtrlCreateListViewItem("line8|data8|more8", $listview)
GUICtrlCreateListViewItem("line9|data9|more9", $listview)
GUICtrlCreateListViewItem("line10|data10|more10", $listview)
GUICtrlCreateListViewItem("line11|data11|more11", $listview)
GUICtrlCreateListViewItem("line12|data12|more12", $listview)
$Btn_GetTop = GUICtrlCreateButton("Get Top Index", 150, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("Remember items are zero-indexed", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_GetTop
GUICtrlSetData($Status, "Top Index: " & _GUICtrlListViewGetTopIndex($listview))
EndSelect
WEnd
Exit


Function _GUICtrlListViewGetUnicodeFormat

Function Reference

_GUICtrlListViewGetUnicodeFormat

Retrieves the UNICODE character format flag for the control

#Include <GuiListView.au3>
_GUICtrlListViewGetUnicodeFormat($h_listview)

Parameters

$h_listview control id/control hWnd

Return Value

If this value is nonzero, the control is using Unicode characters.
If this value is zero, the control is using ANSI characters.

Remarks

The Unicode format flag is used by Microsoft Windows NT systems
with version 4.71 of Comctl32.dll or later. This message is, thus,
supported by Windows 2000 and later, and by Windows NT 4 with Microsoft
Internet Explorer 4.0 or later. It is only useful on Windows 95 or Windows 98
systems with version 5.80 or later of Comctl32.dll.

This means that they must have Internet Explorer 5 or later installed.
Windows 95 and Windows 98 systems with earlier versions of Internet Explorer
ignore the Unicode format flag, and its value has no bearing on whether a control
supports Unicode. With these systems, you will instead need to test something that
requires Unicode support.

Related

None.

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status
GUICreate("ListView Get Unicode Format", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 160, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
If (_GUICtrlListViewGetUnicodeFormat ($listview)) Then
GUICtrlSetData($Status, "ListView is using Unicode Characters")
Else
GUICtrlSetData($Status, "ListView is using ANSI Characters")
EndIf

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlListViewHideColumn

Function Reference

_GUICtrlListViewHideColumn

Hides the column "sets column width to zero"

#Include <GuiListView.au3>
_GUICtrlListViewHideColumn($h_listview,$i_col)

Parameters

$h_listview | control id/control hWnd
$i_col | column to hide (set width to zero)

Return Value

Returns TRUE if successful, or FALSE otherwise

Remarks

None.

Related

_GUICtrlListViewSetColumnWidth, _GUICtrlListViewGetColumnWidth

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_HideCol, $Btn_Exit, $msg, $Input_col, $Status, $Btn_ShowCol
GUICreate("ListView Hide Column Sets Column Width to Zero", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
GUICtrlCreateLabel("Enter Column # to Hide:", 90, 190, 130, 20)
$Input_col = GUICtrlCreateInput("", 220, 190, 80, 20, $ES_NUMBER)
GUICtrlSetLimit($Input_col, 1)
$Btn_HideCol = GUICtrlCreateButton("Hide Column", 75, 230, 90, 40)
$Btn_ShowCol = GUICtrlCreateButton("Show Column", 200, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("Remember columns are zero-indexed", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_HideCol
If (StringLen(GUICtrlRead($Input_col)) > 0) Then
If (_GUICtrlListViewHideColumn ($listview, Int(GUICtrlRead($Input_col)))) Then
GUICtrlSetData($Status, 'Hide column: ' & GUICtrlRead($Input_col) & ' Successful')
Else
GUICtrlSetData($Status, 'Failed to Hide column: ' & GUICtrlRead($Input_col))
EndIf
Else
GUICtrlSetData($Status, 'Must enter a column to hide')
EndIf
Case $msg = $Btn_ShowCol
If (StringLen(GUICtrlRead($Input_col)) > 0) Then
If (_GUICtrlListViewSetColumnWidth ($listview, Int(GUICtrlRead($Input_col)), $LVSCW_AUTOSIZE)) Then
GUICtrlSetData($Status, 'Show column: ' & GUICtrlRead($Input_col) & ' Successful')
Else
GUICtrlSetData($Status, 'Failed to Show column: ' & GUICtrlRead($Input_col))
EndIf
Else
GUICtrlSetData($Status, 'Must enter a column to show')
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewInsertColumn

Function Reference

_GUICtrlListViewInsertColumn

Inserts a column into a list-view control

#Include <GuiListView.au3>
_GUICtrlListViewInsertColumn($h_listview, $i_col, $s_text[, $i_justification=0[, $i_width=25]])

Parameters

$h_listview | control id/control hWnd
$i_col | Zero based index of column position to insert
$s_text | Header Text for column
$i_justification | Optional: type of justification for column
$i_width | Optional: width of the new column (default = 25)

Return Value

Returns TRUE if successful, or FALSE otherwise
if error then $LV_ERR is returned

Remarks

$i_justification
0 = Left (default)
1 = Right
2 = Center

Related

_GUICtrlListViewDeleteColumn, _GUICtrlListViewHideColumn

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

opt('MustDeclareVars', 1)
Dim $listview, $Btn_InsertCol, $Btn_Exit, $msg, $Input_col, $Status
GUICreate("ListView Insert Column", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
GUICtrlCreateLabel("Enter Column # to Insert:", 90, 190, 130, 20)
$Input_col = GUICtrlCreateInput("", 220, 190, 80, 20, $ES_NUMBER)
GUICtrlSetLimit($Input_col, 1)
$Btn_InsertCol = GUICtrlCreateButton("Insert Column", 150, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("Remember columns are zero-indexed", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_InsertCol
If (StringLen(GUICtrlRead($Input_col)) > 0) Then
If (_GUICtrlListViewInsertColumn ($listview, Int(GUICtrlRead($Input_col)), "test", 0, 40)) Then
GUICtrlSetData($Status, 'Insert column: ' & GUICtrlRead($Input_col) & ' Successful')
Else
GUICtrlSetData($Status, 'Failed to Insert column: ' & GUICtrlRead($Input_col))
EndIf
Else
GUICtrlSetData($Status, 'Must enter a column to insert')
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewInsertItem

Function Reference

_GUICtrlListViewInsertItem

Inserts a new item in a list-view control.

#Include <GuiListView.au3>
_GUICtrlListViewInsertItem($h_listview, $i_index, $s_text)

Parameters

$h_listview | control id/control hWnd
$i_index | Zero based index of position to insert. If -1 the item is append to the end.
$s_text | text for the new item

Return Value

Returns the index of the new item if successful, or $LV_ERR otherwise

Remarks

$s_text is "|" delimited text

Related

_GUICtrlListViewDeleteItem, _GUICtrlListViewDeleteItemsSelected

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

;~ Const $LVS_SORTDESCENDING = 0x0020
opt('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $Btn_Insert, $ret, $Input_Index
GUICreate("ListView Insert Item", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
_GUICtrlListViewSetColumnWidth ($listview, 0, 75)
_GUICtrlListViewSetColumnWidth ($listview, 1, 75)
_GUICtrlListViewSetColumnWidth ($listview, 2, 75)
GUICtrlCreateLabel("Enter Item # to Insert To:", 90, 190, 130, 20)
$Input_Index = GUICtrlCreateInput("", 220, 190, 80, 20, $ES_NUMBER)
$Btn_Insert = GUICtrlCreateButton("Insert Item", 150, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Insert
If (StringLen(GUICtrlRead($Input_Index)) > 0) Then
$ret = _GUICtrlListViewInsertItem ($listview, Int(GUICtrlRead($Input_Index)), "test|1|2")
If ($ret <> $LV_ERR) Then
GUICtrlSetData($Status, 'Inserted Item at: ' & $ret)
Else
GUICtrlSetData($Status, 'Failed to Insert Item')
EndIf
Else
GUICtrlSetData($Status, 'Must enter a Item Index to insert')
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewJustifyColumn

Function Reference

_GUICtrlListViewJustifyColumn

Set Justification of a column for a list-view control

#Include <GuiListView.au3>
_GUICtrlListViewJustifyColumn($h_listview, $i_col[, $i_justification=0])

Parameters

$h_listview | control id/control hWnd
$i_col | Zero based index of column Justify
$i_justification | Optional: type of justification for column

Return Value

Returns TRUE if successful, or FALSE otherwise
if error then $LV_ERR is returned

Remarks

$i_justification
0 = Left (default)
1 = Right
2 = Center

Related

None.

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

opt('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status
GUICreate("ListView Justify Column", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
$Status = GUICtrlCreateLabel("Remember columns are zero-indexed", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
If (_GUICtrlListViewJustifyColumn ($listview, 1, 2)) Then
GUICtrlSetData($Status, 'Justify column: 2 Successful')
Else
GUICtrlSetData($Status, 'Failed to Justify column: 2')
EndIf
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
_GUICtrlListViewSetColumnWidth ($listview, 0, 75)
_GUICtrlListViewSetColumnWidth ($listview, 1, 75)
_GUICtrlListViewSetColumnWidth ($listview, 2, 75)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlListViewScroll

Function Reference

_GUICtrlListViewScroll

Scrolls the content of a list-view control

#Include <GuiListView.au3>
_GUICtrlListViewScroll($h_listview, $i_dx, $i_dy)

Parameters

$h_listview | control id/control hWnd
$i_dx | Value of type int that specifies the amount of horizontal scrolling in pixels. If the list-view control is in list-view, this value specifies the number of columns to scroll
$i_dy | Value of type int that specifies the amount of vertical scrolling in pixels

Return Value

Returns TRUE if successful, or FALSE otherwise

Remarks

When the list-view control is in report view, the control can
only be scrolled vertically in whole line increments.

Therefore, the $i_dy parameter will be rounded to the nearest number
of pixels that form a whole line increment.

For example, if the height of a line is 16 pixels and 8 is passed for $i_dy,
the list will be scrolled by 16 pixels (1 line). If 7 is passed for $i_dy,
the list will be scrolled 0 pixels (0 lines).

Related

None.

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_TestScroll, $Btn_Exit, $msg, $Status, $i
GUICreate("ListView Scroll", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
GUICtrlCreateListViewItem("line6|data6|more6", $listview)
GUICtrlCreateListViewItem("line7|data7|more7", $listview)
GUICtrlCreateListViewItem("line8|data8|more8", $listview)
GUICtrlCreateListViewItem("line9|data9|more9", $listview)
GUICtrlCreateListViewItem("line10|data10|more10", $listview)
GUICtrlCreateListViewItem("line11|data11|more11", $listview)
GUICtrlCreateListViewItem("line12|data12|more12", $listview)
$Btn_TestScroll = GUICtrlCreateButton("Scroll Test", 150, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("Remember items are zero-indexed", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_TestScroll
For $i = 10 To 50 Step 10
_GUICtrlListViewScroll($listview,0,$i)
Sleep( 500 )
_GUICtrlListViewScroll($listview,0,$i - ($i * 2))
Sleep( 500 )
Next
EndSelect
WEnd
Exit


Function _GUICtrlListViewSetCheckState

Function Reference

_GUICtrlListViewSetCheckState

Sets the checked state of a list-view control item

#Include <GuiListView.au3>
_GUICtrlListViewSetCheckState($h_listview, $i_index[, $i_check = 1])

Parameters

$h_listview | control id/control hWnd
$i_index | Zero-based index of the item
$i_check | Optional: value to set checked state to (1 = checked, 0 = not checked)

Return Value

Returns TRUE if successful, or FALSE otherwise
If error then $LV_ERR is returned

Remarks

Requires $LVS_EX_CHECKBOXES to be used in extended style when creating listview
$i_index = -1 sets all items
$i_check = 1 (default)

Related

_GUICtrlListViewGetCheckedState

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

opt('MustDeclareVars', 1)
Dim $listview, $Btn_Set, $Btn_SetAll, $Btn_Exit, $msg, $Status, $ret
GUICreate("ListView Set Check State", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_CHECKBOXES, $LVS_EX_CHECKBOXES)
GUICtrlCreateListViewItem("index 0|data1|more1", $listview)
GUICtrlCreateListViewItem("index 1|data2|more2", $listview)
GUICtrlCreateListViewItem("index 2|data3|more3", $listview)
GUICtrlCreateListViewItem("index 3|data4|more4", $listview)
GUICtrlCreateListViewItem("index 4|data5|more5", $listview)
_GUICtrlListViewSetColumnWidth ($listview, 0, 100)
$Btn_Set = GUICtrlCreateButton("Set Index 2", 150, 200, 90, 25)
$Btn_SetAll = GUICtrlCreateButton("Set All", 150, 230, 90, 25)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
Local $check = 1
Local $checkall = 1
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_SetAll
Local $ret = _GUICtrlListViewSetCheckState($listview, -1, $checkall)
$checkall = Not $checkall
If ($ret == $LV_ERR) Then
MsgBox(0, "Error", "Error setting Check state")
EndIf
Case $msg = $Btn_Set
Local $ret = _GUICtrlListViewSetCheckState($listview, 2, $check)
$check = Not $check
If ($ret == $LV_ERR) Then
MsgBox(0, "Error", "Error setting Check state")
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewSetColumnHeaderText

Function Reference

_GUICtrlListViewSetColumnHeaderText

Change the text of a column header for a list-view control

#Include <GuiListView.au3>
_GUICtrlListViewSetColumnHeaderText($h_listview, $i_col, $s_text)

Parameters

$h_listview | control id/control hWnd
$i_col | Zero based index of column Justify
$s_text | New text for column header

Return Value

Returns TRUE if successful, or FALSE otherwise
if error then $LV_ERR is returned

Remarks

None.

Related

None.

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>
#Include <GuiStatusBar.au3>

Opt('MustDeclareVars', 1)
Local $listview, $Btn_Exit, $msg, $Status, $GUI
Local $a_PartsRightEdge[2] = [175, -1]
Local $a_PartsText[2] = ["", ""]
$GUI = GUICreate("ListView Set Column Header Text", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
$Status = _GUICtrlStatusBarCreate ($GUI, $a_PartsRightEdge, $a_PartsText)

If (_GUICtrlListViewJustifyColumn ($listview, 1, 2)) Then
_GUICtrlStatusBarSetText ($Status, "Justify column: 2 Successful", 1)
Else
_GUICtrlStatusBarSetText ($Status, "Failed to Justify column: 2", 1)
EndIf
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
_GUICtrlListViewSetColumnWidth ($listview, 0, 75)
_GUICtrlListViewSetColumnWidth ($listview, 1, 75)
_GUICtrlListViewSetColumnWidth ($listview, 2, 75)
If _GUICtrlListViewSetColumnHeaderText($listview, 1, "new text") Then
_GUICtrlStatusBarSetText ($Status, "Set Header Text: Successful", 0)
Else
_GUICtrlStatusBarSetText ($Status, "Failed to Set Header Text", 0)
EndIf
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd
Exit


Function _GUICtrlListViewSetColumnOrder

Function Reference

_GUICtrlListViewSetColumnOrder

Sets the left-to-right order of columns in a list-view control.

#Include <GuiListView.au3>
_GUICtrlListViewSetColumnOrder($h_listview, $s_order)

Parameters

$h_listbox | control id/control hWnd
$s_order | "|" delimited column order i.e. "2|0|3|1"

Return Value

Returns nonzero if successful, or zero otherwise.
If an error occurs, the return value is $LV_ERR.

Remarks

Columns are Zero-based

Related

_GUICtrlListViewGetColumnOrder

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

opt('MustDeclareVars', 1)

Dim $listview, $button, $msg, $i, $ret

GUICreate("ListView Set Column Order", 392, 254)
$listview = GUICtrlCreateListView("col1|col2|col3|col4", 100, 10, 200, 100, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_HEADERDRAGDROP, $LVS_EX_HEADERDRAGDROP)
$button = GUICtrlCreateButton("Set Order", 150, 120, 90, 30)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlListViewSetColumnOrder($listview, "3|2|0|1")
EndSelect
WEnd


Function _GUICtrlListViewSetColumnWidth

Function Reference

_GUICtrlListViewSetColumnWidth

Changes the width of a column

#Include <GuiListView.au3>
_GUICtrlListViewSetColumnWidth($h_listview, $i_col, $i_width)

Parameters

$h_listview | control id/control hWnd
$i_col | Zero-based index of a valid column. For list-view mode, this parameter must be set to zero
$i_width | New width of the column, in pixels.

Return Value

Returns TRUE if successful, or FALSE otherwise.

Remarks

For report-view mode, the following special values are supported:

$LVSCW_AUTOSIZE | Automatically sizes the column.
$LVSCW_AUTOSIZE_USEHEADER | Automatically sizes the column to fit the header text. If you use this value with the last column, its width is set to fill the remaining width of the list-view control

Related

_GUICtrlListViewGetColumnWidth, _GUICtrlListViewHideColumn

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_SetWidth, $Btn_Exit, $msg, $Input_width, $Status
GUICreate("ListView Sets Column Width", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
GUICtrlCreateLabel("Enter Column Width:", 90, 190, 130, 20)
$Input_width = GUICtrlCreateInput("", 220, 190, 80, 20, $ES_NUMBER)
GUICtrlSetLimit($Input_width, 3)
$Btn_SetWidth = GUICtrlCreateButton("Set Width", 75, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_SetWidth
If (StringLen(GUICtrlRead($Input_width)) > 0) Then
If (_GUICtrlListViewSetColumnWidth ($listview, 1, Int(GUICtrlRead($Input_width)))) Then
GUICtrlSetData($Status, 'Set Column Width Successful')
Else
GUICtrlSetData($Status, 'Failed to set column width')
EndIf
Else
GUICtrlSetData($Status, 'Must enter a width')
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewSetHotItem

Function Reference

_GUICtrlListViewSetHotItem

Sets the hot item for a list-view control

#Include <GuiListView.au3>
_GUICtrlListViewSetHotItem($h_listview, $i_index)

Parameters

$h_listview | control id/control hWnd
$i_index | Zero-based index of the item to be set as the hot item

Return Value

Returns the index of the item that was previously hot
$LV_ERR is returned if no item previously hot

Remarks

None.

Related

_GUICtrlListViewGetHotItem, _GUICtrlListViewGetHoverTime, _GUICtrlListViewSetHoverTime

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $Btn_set
GUICreate("ListView Set Hot Item", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_TRACKSELECT, $LVS_EX_TRACKSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_set = GUICtrlCreateButton("Set index 2", 75, 260, 70, 30)
$Btn_Exit = GUICtrlCreateButton("Exit", 200, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_set
_GUICtrlListViewSetHotItem($listview,2)
GUICtrlSetData($Status, "Hot Item: " & _GUICtrlListViewGetHotItem ($listview))
EndSelect
WEnd
Exit


Function _GUICtrlListViewSetHoverTime

Function Reference

_GUICtrlListViewSetHoverTime

Sets the amount of time which the mouse cursor must hover over an item before it is selected

#Include <GuiListView.au3>
_GUICtrlListViewSetHoverTime($h_listview, $i_time)

Parameters

$h_listview | control id/control hWnd
$i_time | The new amount of time, in milliseconds

Return Value

Returns the previous hover time

Remarks

If $i_time value is -1, then the hover time is set to the default hover time
The hover time only affects list-view controls that have the
$LVS_EX_TRACKSELECT, $LVS_EX_ONECLICKACTIVATE, or
$LVS_EX_TWOCLICKACTIVATE extended list-view style

Related

_GUICtrlListViewGetHoverTime, _GUICtrlListViewGetHotItem

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_SetHoverTime, $Btn_Exit, $msg, $Input, $Status, $ret, $current
GUICreate("ListView Sets Hover Time", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_TRACKSELECT, $LVS_EX_TRACKSELECT)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
GUICtrlCreateLabel("Enter Hover Time:", 90, 190, 130, 20)
$Input = GUICtrlCreateInput("", 220, 190, 80, 20, $ES_NUMBER)
GUICtrlSetLimit($Input, 3)
$Btn_SetHoverTime = GUICtrlCreateButton("Set Hover Time", 75, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$current = _GUICtrlListViewGetHoverTime ($listview)
$Status = GUICtrlCreateLabel("Hover Time:" & $current, 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
If ($current <> _GUICtrlListViewGetHoverTime ($listview)) Then
GUICtrlSetData($Status, "Hover Time:" & _GUICtrlListViewGetHoverTime ($listview))
$current = _GUICtrlListViewGetHoverTime ($listview)
EndIf
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_SetHoverTime
If (StringLen(GUICtrlRead($Input)) > 0) Then
$ret = _GUICtrlListViewSetHoverTime ($listview, Int(GUICtrlRead($Input)))
EndIf
EndSelect
WEnd
Exit


Function _GUICtrlListViewSetItemCount

Function Reference

_GUICtrlListViewSetItemCount

Causes the list-view control to allocate memory for the specified number of items.

#Include <GuiListView.au3>
_GUICtrlListViewSetItemCount($h_listview, $i_items)

Parameters

$h_listbox | control id/control hWnd
$i_items | Number of items that the list-view control will ultimately contain.

Return Value

Returns nonzero if successful, or zero otherwise.
If an error occurs, the return value is $LV_ERR.

Remarks

Causes the control to allocate its internal data structures for the specified number of items.
This prevents the control from having to allocate the data structures every time an item is added.

Related

None.

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

opt('MustDeclareVars', 1)

Dim $listview, $button, $msg, $i, $ret, $s_item

GUICreate("ListView Set Item Count", 392, 254)
$listview = GUICtrlCreateListView("col1|col2|col3|col4", 100, 10, 200, 100, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_HEADERDRAGDROP, $LVS_EX_HEADERDRAGDROP)
$button = GUICtrlCreateButton("Add Items", 150, 120, 90, 30)
_GUICtrlListViewSetItemCount($listview, 20)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
For $i = 0 To 19
$s_item = $i & "|" & $i & "|" & $i & "|" & $i
GUICtrlCreateListViewItem($s_item, $listview)
Next
EndSelect
WEnd


Function _GUICtrlListViewSetItemSelState

Function Reference

_GUICtrlListViewSetItemSelState

Sets the Item Selected/UnSelected

#Include <GuiListView.au3>
_GUICtrlListViewSetItemSelState($h_listview, $i_index[, $i_selected = 1[, $i_focused = 0]])

Parameters

$h_listview | control id/control hWnd
$i_index | Zero-based index of the item
$i_selected | Optional: set the state of the item (1 = selected, 0 = not selected)
$i_focused | Optional: set the state of the item (1 = focused, 0 = not focused)

Return Value

1 if successful, 0 otherwise
If error then $LV_ERR is returned

Remarks

$i_index = -1 sets all items for MultiSelect ListView
$i_selected = 1 (default)

Related

_GUICtrlListViewGetSelectedCount, _GUICtrlListViewGetSelectedIndices

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

opt('MustDeclareVars', 1)
Dim $listview, $Btn_Set, $Btn_Exit, $msg, $Status, $ret, $Btn_UnSet
GUICreate("ListView Set Item Sel State", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("index 0|data1|more1", $listview)
GUICtrlCreateListViewItem("index 1|data2|more2", $listview)
GUICtrlCreateListViewItem("index 2|data3|more3", $listview)
GUICtrlCreateListViewItem("index 3|data4|more4", $listview)
GUICtrlCreateListViewItem("index 4|data5|more5", $listview)
_GUICtrlListViewSetColumnWidth ($listview, 0, 100)
$Btn_Set = GUICtrlCreateButton("Set Index 2 Selected", 150, 200, 120, 40)
$Btn_UnSet = GUICtrlCreateButton("UnSet Index 2 Selected", 150, 250, 120, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
_GUICtrlListViewSetItemSelState ($listview, -1)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Set
_GUICtrlListViewSetItemSelState ($listview, 2)
Case $msg = $Btn_UnSet
_GUICtrlListViewSetItemSelState ($listview, 2, 0)
EndSelect
WEnd
Exit


Function _GUICtrlListViewSetItemText

Function Reference

_GUICtrlListViewSetItemText

Changes the text of a list-view item or subitem.

#Include <GuiListView.au3>
_GUICtrlListViewSetItemText($h_listview, $i_index, $i_subitem, $s_text)

Parameters

$h_listview | control id/control hWnd
$i_index | Zero-based index of the item
$i_subitem | Index of the subitem, or it can be zero to set the item label.
$s_text | String containing the new text

Return Value

Success: | Returns 1
Failure: | Returns 0 or if error $LV_ERR

Remarks

None.

Related

_GUICtrlListViewGetItemText

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

opt('MustDeclareVars', 1)
Dim $listview, $Btn_SetItem0, $Btn_Exit, $msg, $Status, $ret, $Btn_SetSub1
GUICreate("ListView Set Item Text", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER))
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("index 0|data1|more1", $listview)
GUICtrlCreateListViewItem("index 1|data2|more2", $listview)
GUICtrlCreateListViewItem("index 2|data3|more3", $listview)
GUICtrlCreateListViewItem("index 3|data4|more4", $listview)
GUICtrlCreateListViewItem("index 4|data5|more5", $listview)
_GUICtrlListViewSetColumnWidth ($listview, 0, 100)
$Btn_SetItem0 = GUICtrlCreateButton("Set 2 Item", 150, 200, 120, 40)
$Btn_SetSub1 = GUICtrlCreateButton("Set 2 SubItem", 150, 250, 120, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_SetItem0
_GUICtrlListViewSetItemText ($listview, 2, 0, "Testing")
Case $msg = $Btn_SetSub1
_GUICtrlListViewSetItemText ($listview, 2, 1, "Sub")
EndSelect
WEnd
Exit


Function _GUICtrlListViewSort

Function Reference

_GUICtrlListViewSort

Sorts a list-view control.

#Include <GuiListView.au3>
_GUICtrlListViewSort( $h_listview, ByRef $v_descending, $i_sortcol)

Parameters

$h_listview | control id/control hWnd
$v_descending | boolean value, can be a single value or array
$i_sortcol | column to sort on

Return Value

None

Remarks

Utilizes the _ArraySort User Defined Function

Related

None.

Example

#include <GuiConstants.au3>
#include <GuiListView.au3>

opt('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $Btn_Insert, $ret, $Input_Index
GUICreate("ListView Sort", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("line4|5|more_a", $listview)
GUICtrlCreateListViewItem("line5|4.50 |more_c", $listview)
GUICtrlCreateListViewItem("line5|4.0 |more_c", $listview)
GUICtrlCreateListViewItem("line3|23|more_e", $listview)
GUICtrlCreateListViewItem("line2|0.34560 |more_d", $listview)
GUICtrlCreateListViewItem("line1|1.0 |more_b", $listview)
GUICtrlCreateListViewItem("line1|0.1 |more_b", $listview)
GUICtrlCreateListViewItem("line1|10|more_b", $listview)
_GUICtrlListViewSetColumnWidth ($listview, 0, 75)
_GUICtrlListViewSetColumnWidth ($listview, 1, 75)
_GUICtrlListViewSetColumnWidth ($listview, 2, 75)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)

GUISetState()

Dim $B_DESCENDING[_GUICtrlListViewGetSubItemsCount ($listview) ]

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $listview
; sort the list by the column header clicked on
_GUICtrlListViewSort($listview, $B_DESCENDING, GUICtrlGetState($listview))
EndSelect
WEnd

Exit


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: GuiMonthCal Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_GUICtrlMonthCalGet1stDOW | Retrieves the first day of the week for a month calendar control.
_GUICtrlMonthCalGetColor | Retrieves the color for a given portion of a month calendar control.
_GUICtrlMonthCalGetDelta | Retrieves the scroll rate for a month calendar control.
_GUICtrlMonthCalGetMaxSelCount | Retrieves the maximum date range that can be selected in a month calendar control.
_GUICtrlMonthCalGetMaxTodayWidth | Retrieves the maximum width of the "today" string in a month calendar control.
_GUICtrlMonthCalGetMinReqRECT | Retrieves the minimum size required to display a full month in a month calendar control.
_GUICtrlMonthCalSet1stDOW | Sets the first day of the week for a month calendar control.
_GUICtrlMonthCalSetColor | Sets the color for a given portion of a month calendar control.
_GUICtrlMonthCalSetDelta | Sets the scroll rate for a month calendar control.
_GUICtrlMonthCalSetMaxSelCount | Sets the maximum number of days that can be selected in a month calendar control.


Function _GUICtrlMonthCalGet1stDOW

Function Reference

_GUICtrlMonthCalGet1stDOW

Retrieves the first day of the week for a month calendar control.

#Include <GuiMonthCal.au3>
_GUICtrlMonthCalGet1stDOW($h_monthcal)

Parameters

$h_monthcal control id/control hWnd

Return Value

String of 1st Day Of Week

Remarks

None.

Related

_GUICtrlMonthCalSet1stDOW

Example

#include <GUIConstants.au3>
#include <date.au3>
#include <GuiMonthCal.au3>

opt('MustDeclareVars', 1)

Dim $Date

GUICreate( "Get First Day Of Week", 210, 190)

$Date = GUICtrlCreateMonthCal (_NowCalcDate(), 10, 10)
MsgBox(0, "First Day Of Week", _GUICtrlMonthCalGet1stDOW ($Date), 10)


Function _GUICtrlMonthCalGetColor

Function Reference

_GUICtrlMonthCalGetColor

Retrieves the color for a given portion of a month calendar control.

#Include <GuiMonthCal.au3>
_GUICtrlMonthCalGetColor($h_monthcal, $i_color)

Parameters

$h_monthcal | control id/control hWnd
$i_color | Value of type int specifying which month calendar color to retrieve.

Return Value

Array containing the color

Remarks

$i_color this value can be one of the following:

$MCSC_BACKGROUND | Retrieve the background color displayed between months.
$MCSC_MONTHBK | Retrieve the background color displayed within the month.
$MCSC_TEXT | Retrieve the color used to display text within a month.
$MCSC_TITLEBK | Retrieve the background color displayed in the calendar's title.
$MCSC_TITLETEXT | Retrieve the color used to display text within the calendar's title.
$MCSC_TRAILINGTEXT | Retrieve the color used to display header day and trailing day text. Header and trailing days are the days from the previous and following months that appear on the current month calendar.

Array returned
$array[0] - contains the number returned
$array[1] - contains COLORREF rgbcolor
$array[2] - contains Hex BGR color
$array[3] - contains Hex RGB color

Related

_GUICtrlMonthCalSetColor

Example

#include <GUIConstants.au3>
#include <date.au3>
#include <GuiMonthCal.au3>

opt('MustDeclareVars', 1)

Dim $Date, $i, $a_colors

GUICreate( "Get Color", 210, 190)

$Date = GUICtrlCreateMonthCal (_NowCalcDate(), 10, 10)
GUISetState()

; 1 - COLORREF rgbcolor
; 2 - Hex BGR color
; 3 - Hex RGB color
$a_colors = _GUICtrlMonthCalGetColor ($Date, $MCSC_BACKGROUND)
For $i = 1 To $a_colors[0]
MsgBox(0, "Background color displayed between months.", $a_colors[$i])
Next

$a_colors = _GUICtrlMonthCalGetColor ($Date, $MCSC_MONTHBK)
For $i = 1 To $a_colors[0]
MsgBox(0, "Background color displayed within the month.", $a_colors[$i])
Next

$a_colors = _GUICtrlMonthCalGetColor ($Date, $MCSC_TEXT)
For $i = 1 To $a_colors[0]
MsgBox(0, "Color used to display text within a month.", $a_colors[$i])
Next

$a_colors = _GUICtrlMonthCalGetColor ($Date, $MCSC_TITLEBK)
For $i = 1 To $a_colors[0]
MsgBox(0, "Background color displayed in the calendar's title.", $a_colors[$i])
Next

$a_colors = _GUICtrlMonthCalGetColor ($Date, $MCSC_TITLETEXT)
For $i = 1 To $a_colors[0]
MsgBox(0, "Color used to display text within the calendar's title.", $a_colors[$i])
Next

$a_colors = _GUICtrlMonthCalGetColor ($Date, $MCSC_TRAILINGTEXT)
For $i = 1 To $a_colors[0]
MsgBox(0, "Color used to display header day and trailing day text.", $a_colors[$i])
Next


Function _GUICtrlMonthCalGetDelta

Function Reference

_GUICtrlMonthCalGetDelta

Retrieves the scroll rate for a month calendar control.

#Include <GuiMonthCal.au3>
_GUICtrlMonthCalGetDelta($h_monthcal)

Parameters

$h_monthcal control id/control hWnd

Return Value

If the month delta was previously set using the _GUICtrlMonthCalSetDelta,
returns an INT value that represents the month calendar's current scroll rate.
If the month delta was not previously set using the _GUICtrlMonthCalSetDelta,
or the month delta was reset to the default, returns an INT value that
represents the current number of months visible.

Remarks

None.

Related

_GUICtrlMonthCalSetDelta

Example

#include <GUIConstants.au3>
#include <date.au3>
#include <GuiMonthCal.au3>

opt('MustDeclareVars', 1)

Dim $Date, $Btn_Exit, $Status, $msg

GUICreate( "Get Delta", 392, 254)

$Date = GUICtrlCreateMonthCal (_NowCalcDate(), 90, 10, 200, 160)

$Status = GUICtrlCreateLabel("", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

$Btn_Exit = GUICtrlCreateButton("Exit", 150, 180, 90, 30)

GUISetState()
GUICtrlSetData($Status, "Month Delta: " & _GUICtrlMonthCalGetDelta ($Date))
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd


Function _GUICtrlMonthCalGetMaxSelCount

Function Reference

_GUICtrlMonthCalGetMaxSelCount

Retrieves the maximum date range that can be selected in a month calendar control.

#Include <GuiMonthCal.au3>
_GUICtrlMonthCalGetMaxSelCount($h_monthcal)

Parameters

$h_monthcal control id/control hWnd

Return Value

Returns an INT value that represents the total number of days that can be selected for the control.

Remarks

None.

Related

_GUICtrlMonthCalSetMaxSelCount

Example

#include <GUIConstants.au3>
#include <date.au3>
#include <GuiMonthCal.au3>

opt('MustDeclareVars', 1)

Dim $Date

GUICreate( "Get Max Sel Count", 210, 190)

$Date = GUICtrlCreateMonthCal (_NowCalcDate(), 10, 10)
GUISetState()

MsgBox(0, "Total number of days that can be selected for the control.", _GUICtrlMonthCalGetMaxSelCount ($Date), 10)


Function _GUICtrlMonthCalGetMaxTodayWidth

Function Reference

_GUICtrlMonthCalGetMaxTodayWidth

Retrieves the maximum width of the "today" string in a month calendar control.

#Include <GuiMonthCal.au3>
_GUICtrlMonthCalGetMaxTodayWidth($h_monthcal)

Parameters

$h_monthcal control id/control hWnd

Return Value

Returns the width of the "today" string, in pixels.

Remarks

None.

Related

None.

Example

#include <GUIConstants.au3>
#include <date.au3>
#include <GuiMonthCal.au3>

opt('MustDeclareVars', 1)

Dim $Date

GUICreate( "Get Max Today Width", 210, 190)

$Date = GUICtrlCreateMonthCal (_NowCalcDate(), 10, 10)
GUISetState()

MsgBox(0, 'Maximum width of the "today" string in a month calendar control.', _GUICtrlMonthCalGetMaxTodayWidth ($Date), 10)


Function _GUICtrlMonthCalGetMinReqRECT

Function Reference

_GUICtrlMonthCalGetMinReqRECT

Retrieves the minimum size required to display a full month in a month calendar control.

#Include <GuiMonthCal.au3>
_GUICtrlMonthCalGetMinReqRECT($h_monthcal)

Parameters

$h_monthcal control id/control hWnd

Return Value

Array containing the RECT, first element ($array[0]) contains the number of elements
if error -1 is returned

Remarks

The minimum required window size for a month calendar control depends on the currently selected font,
control styles, system metrics, and regional settings.

Related

None.

Example

#include <GUIConstants.au3>
#include <date.au3>
#include <GuiMonthCal.au3>

opt('MustDeclareVars', 1)

Dim $Date, $s_rect, $label_rect, $Btn_GETRECT, $Btn_Exit, $msg

GUICreate("Month Calender Get Min Required RECT", 400, 250)

$Date = GUICtrlCreateMonthCal (_NowCalcDate(), 10, 10)

$s_rect = "Left:" & @LF & "Top:" & @LF & "Right:" & @LF & "Bottom:"
$label_rect = GUICtrlCreateLabel($s_rect, 270, 40, 100, 55, $SS_SUNKEN)

$Btn_GETRECT = GUICtrlCreateButton("Get Rect", 270, 120, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 180, 90, 30)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_GETRECT
Local $rect_array = _GUICtrlMonthCalGetMinReqRECT ($Date)
If (IsArray($rect_array)) Then
$s_rect = "Left:" & $rect_array[1] & @LF & "Top:" & $rect_array[2] & @LF & "Right:" & $rect_array[3] & @LF & "Bottom:" & $rect_array[4]
GUICtrlSetData($label_rect, $s_rect)
EndIf
EndSelect
WEnd


Function _GUICtrlMonthCalSet1stDOW

Function Reference

_GUICtrlMonthCalSet1stDOW

Sets the first day of the week for a month calendar control.

#Include <GuiMonthCal.au3>
_GUICtrlMonthCalSet1stDOW($h_monthcal, $s_day)

Parameters

$h_monthcal | control id/control hWnd
$s_day | Value representing which day is to be set as the first day of the week.

Return Value

The previous first day of the week.
if error -1 is returned

Remarks

$s_day:
0 or "Monday"
1 or "Tuesday"
2 or "Wednesday"
3 or "Thursday"
4 or "Friday"
5 or "Saturday"
6 or "Sunday"

Related

_GUICtrlMonthCalGet1stDOW

Example

#include <GUIConstants.au3>
#include <date.au3>
#include <GuiMonthCal.au3>

opt('MustDeclareVars', 1)

Dim $Date, $Btn_Exit, $Combo, $msg

GUICreate( "Set First Day Of Week", 450, 254)

$Date = GUICtrlCreateMonthCal (_NowCalcDate(), 10, 10)

$Btn_Exit = GUICtrlCreateButton("Exit", 180, 180, 90, 30)

$Combo = GUICtrlCreateCombo("", 220, 10, 100, 21, $CBS_DROPDOWNLIST)
GUICtrlSetData($Combo, "Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday", "Sunday")

GUISetState()

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Combo
_GUICtrlMonthCalSet1stDOW ($Date, GUICtrlRead($Combo))
EndSelect
WEnd


Function _GUICtrlMonthCalSetColor

Function Reference

_GUICtrlMonthCalSetColor

Sets the color for a given portion of a month calendar control.

#Include <GuiMonthCal.au3>
_GUICtrlMonthCalSetColor($h_monthcal, $i_color, $i_colorref[, $i_refType = 0])

Parameters

$h_monthcal | control id/control hWnd
$i_color | Value of type int specifying which month calendar color to set.
$i_colorref | Value that represents the color that will be set for the specified area of the month calendar.
$i_refType | Optional: Type of value used for $i_colorref

Return Value

Success: | Returns an array of the previous color setting for the specified portion of the month calendar control
Failure: | Returns -1

Remarks

$i_color this value can be one of the following:

$MCSC_BACKGROUND | Set the background color displayed between months.
$MCSC_MONTHBK | Set the background color displayed within the month.
$MCSC_TEXT | Set the color used to display text within a month.
$MCSC_TITLEBK | Set the background color displayed in the calendar's title.
$MCSC_TITLETEXT | Set the color used to display text within the calendar's title.
$MCSC_TRAILINGTEXT | Set the color used to display header day and trailing day text. Header and trailing days are the days from the previous and following months that appear on the current month calendar.

$i_refType = 0 $i_colorref is COLORREF rgbcolor (default)
$i_refType = 1 $i_colorref is Hex BGR color
$i_refType = 0 $i_colorref is Hex RGB color

Value returned:
array[0] = number of elements
array[1] = COLORREF rbgcolor
array[2] = Hex BGR color
array[3] = Hex RGB color

Related

_GUICtrlMonthCalGetColor

Example

#include <GUIConstants.au3>
#include <date.au3>
#include <GuiMonthCal.au3>

opt('MustDeclareVars', 1)

Dim $Date, $i, $a_colors, $Btn_Exit, $msg

GUICreate( "Set Color", 450, 254)

$Date = GUICtrlCreateMonthCal (_NowCalcDate(), 10, 10, 430, 160, 0, 0)

$Btn_Exit = GUICtrlCreateButton("Exit", 180, 180, 90, 30)

GUISetState()

; returns array of previous color if setcolor is successful
; 1 - COLORREF rgbcolor
; 2 - Hex BGR color
; 3 - Hex RGB color

; Set the background color displayed between months.
$a_colors = _GUICtrlMonthCalSetColor ($Date, $MCSC_BACKGROUND, 255)

;Set the background color displayed within the month.
$a_colors = _GUICtrlMonthCalSetColor ($Date, $MCSC_MONTHBK, 0xff0000, 1)

;Set the color used to display text within a month.
$a_colors = _GUICtrlMonthCalSetColor ($Date, $MCSC_TEXT, 0x00ffff, 1)

;Set the background color displayed in the calendar's title.
$a_colors = _GUICtrlMonthCalSetColor ($Date, $MCSC_TITLEBK, 0x000000, 2)

;Set the color used to display text within the calendar's title.
$a_colors = _GUICtrlMonthCalSetColor ($Date, $MCSC_TITLETEXT, 0xC0C0C0, 2)

;Set the color used to display header day and trailing day text.
$a_colors = _GUICtrlMonthCalSetColor ($Date, $MCSC_TRAILINGTEXT, 0xe6e6fa, 2)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
EndSelect
WEnd


Function _GUICtrlMonthCalSetDelta

Function Reference

_GUICtrlMonthCalSetDelta

Sets the scroll rate for a month calendar control.

#Include <GuiMonthCal.au3>
_GUICtrlMonthCalSetDelta($h_monthcal, $i_delta)

Parameters

$h_monthcal | control id/control hWnd
$i_delta | Value representing the number of months to be set as the control's scroll rate.

Return Value

Returns an INT value that represents the previous scroll rate.

Remarks

$i_delta
If this value is zero, the month delta is reset to the default,
which is the number of months displayed in the control.

Related

_GUICtrlMonthCalGetDelta

Example

#include <GUIConstants.au3>
#include <date.au3>
#include <GuiMonthCal.au3>

opt('MustDeclareVars', 1)

Dim $Date, $Btn_Exit, $Combo, $msg

GUICreate( "Set Delta", 450, 254)

$Date = GUICtrlCreateMonthCal (_NowCalcDate(), 10, 10, 190, 155, $MCS_MULTISELECT)

$Btn_Exit = GUICtrlCreateButton("Exit", 180, 180, 90, 30)

$Combo = GUICtrlCreateCombo("", 220, 10, 100, 21, $CBS_DROPDOWNLIST)
GUICtrlSetData($Combo, "1|2|3|4|5|6|7|8|9|10|11|12", "1")

GUISetState()

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Combo
_GUICtrlMonthCalSetDelta ($Date, Int(GUICtrlRead($Combo)))
EndSelect
WEnd


Function _GUICtrlMonthCalSetMaxSelCount

Function Reference

_GUICtrlMonthCalSetMaxSelCount

Sets the maximum number of days that can be selected in a month calendar control.

#Include <GuiMonthCal.au3>
_GUICtrlMonthCalSetMaxSelCount($h_monthcal, $i_maxsel)

Parameters

$h_monthcal | control id/control hWnd
$i_maxsel | Value of type int that will be set to represent the maximum number of days that can be selected.

Return Value

Returns nonzero if successful, or zero otherwise.

Remarks

This will fail if applied to a month calendar control that does not use the $MCS_MULTISELECT style.

Related

_GUICtrlMonthCalGetMaxSelCount

Example

#include <GUIConstants.au3>
#include <date.au3>
#include <GuiMonthCal.au3>

opt('MustDeclareVars', 1)

Dim $Date, $Btn_Exit, $Combo, $msg, $Status

GUICreate( "Set Max Sel Count", 450, 254)

$Date = GUICtrlCreateMonthCal (_NowCalcDate(), 10, 10, 190, 155, $MCS_MULTISELECT)
$Status = GUICtrlCreateLabel("", 0, 234, 450, 20, BitOR($SS_SUNKEN, $SS_CENTER))

$Btn_Exit = GUICtrlCreateButton("Exit", 180, 180, 90, 30)

$Combo = GUICtrlCreateCombo("", 220, 10, 100, 21, $CBS_DROPDOWNLIST)
GUICtrlSetData($Combo, "1|2|3|4|5|6|7|8|9|10|11|12", "1")

GUISetState()

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Combo
If (_GUICtrlMonthCalSetMaxSelCount ($Date, GUICtrlRead($Combo))) Then
GUICtrlSetData($Status, "Successful")
Else
GUICtrlSetData($Status, "Failed")
EndIf
EndSelect
WEnd


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: GuiSlider Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_GUICtrlSliderClearTics | Removes the current tick marks from a slider.
_GUICtrlSliderGetLineSize | Retrieves the number of logical positions the slider moves.
_GUICtrlSliderGetNumTics | Retrieves the number of tick marks from a slider.
_GUICtrlSliderGetPageSize | Retrieves the number of logical positions the slider moves.
_GUICtrlSliderGetPos | Retrieves the logical position the slider.
_GUICtrlSliderGetRangeMax | Retrieves the maximum position for the slider.
_GUICtrlSliderGetRangeMin | Retrieves the minimum position for the slider.
_GUICtrlSliderSetLineSize | Sets the number of logical positions the slider moves.
_GUICtrlSliderSetPageSize | Sets the number of logical positions the slider moves.
_GUICtrlSliderSetPos | Sets the current logical position of the slider.
_GUICtrlSliderSetTicFreq | Sets the interval frequency for tick marks in a slider.


Function _GUICtrlSliderClearTics

Function Reference

_GUICtrlSliderClearTics

Removes the current tick marks from a slider.

#Include <GuiSlider.au3>
_GUICtrlSliderClearTics($h_slider)

Parameters

$h_slider handle of the control

Return Value

None.

Remarks

This does not remove the first and last tick marks, which are created automatically.

Related

None.

Example

#include <GUIConstants.au3>
#include <GuiSlider.au3>

opt('MustDeclareVars', 1)

Dim $Gui_Slider, $slider1, $button, $msg, $h_slider

$Gui_Slider = GUICreate("Slider Clear Tics", 220, 100, 100, 200)
GUISetBkColor(0x00E0FFFF) ; will change background color

$slider1 = GUICtrlCreateSlider(10, 10, 200, 20)
GUICtrlSetLimit(-1, 200, 0) ; change min/max value
$button = GUICtrlCreateButton("Clear Tics", 75, 70, 70, 20)
GUISetState()
GUICtrlSetData($slider1, 45) ; set cursor
$h_slider = ControlGetHandle($Gui_Slider, "", "msctls_trackbar321")
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
_GUICtrlSliderClearTics ($h_slider)
EndSelect
WEnd


Function _GUICtrlSliderGetLineSize

Function Reference

_GUICtrlSliderGetLineSize

Retrieves the number of logical positions the slider moves.

#Include <GuiSlider.au3>
_GUICtrlSliderGetLineSize($h_slider)

Parameters

$h_slider handle of the control

Return Value

Returns value that specifies the line size for the slider.

Remarks

Retrieves the number of logical positions the slider moves in response to keyboard input from the arrow keys.
The logical positions are the integer increments in the slider's range of minimum to maximum slider positions.

Related

_GUICtrlSliderSetLineSize

Example

#include <GUIConstants.au3>
#include <GuiSlider.au3>

opt('MustDeclareVars', 1)

Dim $Gui_Slider, $slider1, $msg, $h_slider, $Status

$Gui_Slider = GUICreate("Slider Get Line Size", 220, 100, 100, 200)
GUISetBkColor(0x00E0FFFF) ; will change background color

$slider1 = GUICtrlCreateSlider(10, 10, 200, 20)
GUICtrlSetLimit(-1, 200, 0) ; change min/max value
GUISetState()
GUICtrlSetData($slider1, 45) ; set cursor
$h_slider = ControlGetHandle($Gui_Slider, "", "msctls_trackbar321")
$Status = GUICtrlCreateLabel("Line Size: " & _GUICtrlSliderGetLineSize ($h_slider), 0, 80, 220, 20, BitOR($SS_SUNKEN, $SS_CENTER))
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlSliderGetNumTics

Function Reference

_GUICtrlSliderGetNumTics

Retrieves the number of tick marks from a slider.

#Include <GuiSlider.au3>
_GUICtrlSliderGetNumTics($h_slider)

Parameters

$h_slider handle of the control

Return Value

If no tick flag is set, it returns 2 for the beginning and ending ticks.
If $TBS_NOTICKS is set, it returns zero.
Otherwise, it takes the difference between the range minimum and maximum, divides by the tick frequency, and adds 2.

Remarks

None.

Related

_GUICtrlSliderSetTicFreq

Example

#include <GUIConstants.au3>
#include <GuiSlider.au3>

opt('MustDeclareVars', 1)

Dim $Gui_Slider, $slider1, $msg, $h_slider, $Status

$Gui_Slider = GUICreate("Slider Get Num Tics", 220, 100, 100, 200)
GUISetBkColor(0x00E0FFFF) ; will change background color

$slider1 = GUICtrlCreateSlider(10, 10, 200, 20)
GUICtrlSetLimit(-1, 200, 0) ; change min/max value
GUISetState()
GUICtrlSetData($slider1, 45) ; set cursor
$h_slider = ControlGetHandle($Gui_Slider, "", "msctls_trackbar321")
$Status = GUICtrlCreateLabel("Num of Tics: " & _GUICtrlSliderGetNumTics ($h_slider), 0, 80, 220, 20, BitOR($SS_SUNKEN, $SS_CENTER))
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlSliderGetPageSize

Function Reference

_GUICtrlSliderGetPageSize

Retrieves the number of logical positions the slider moves.

#Include <GuiSlider.au3>
_GUICtrlSliderGetPageSize($h_slider)

Parameters

$h_slider handle of the control

Return Value

Returns a value that specifies the page size for the slider.

Remarks

Retrieves the number of logical positions the slider moves in response to keyboard input,
or mouse input, such as clicks in the sliders's channel.
The logical positions are the integer increments in the slider's range of minimum to maximum slider positions.

Related

_GUICtrlSliderSetPageSize

Example

#include <GUIConstants.au3>
#include <GuiSlider.au3>

opt('MustDeclareVars', 1)

Dim $Gui_Slider, $slider1, $msg, $h_slider, $Status

$Gui_Slider = GUICreate("Slider Get Page Size", 220, 100, 100, 200)
GUISetBkColor(0x00E0FFFF) ; will change background color

$slider1 = GUICtrlCreateSlider(10, 10, 200, 20)
GUICtrlSetLimit(-1, 200, 0) ; change min/max value
GUISetState()
GUICtrlSetData($slider1, 45) ; set cursor
$h_slider = ControlGetHandle($Gui_Slider, "", "msctls_trackbar321")
$Status = GUICtrlCreateLabel("Page Size: " & _GUICtrlSliderGetPageSize ($h_slider), 0, 80, 220, 20, BitOR($SS_SUNKEN, $SS_CENTER))
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlSliderGetPos

Function Reference

_GUICtrlSliderGetPos

Retrieves the logical position the slider.

#Include <GuiSlider.au3>
_GUICtrlSliderGetPos($h_slider)

Parameters

$h_slider handle of the control

Return Value

Returns a value that specifies the logical position of the slider.

Remarks

None.

Related

_GUICtrlSliderSetPos

Example

#include <GUIConstants.au3>
#include <GuiSlider.au3>

opt('MustDeclareVars', 1)

Dim $Gui_Slider, $slider1, $button, $msg, $h_slider, $Status, $Pos = 0

$Gui_Slider = GUICreate("Slider Get Pos",220,100)
GUISetBkColor (0x00E0FFFF) ; will change background color

$slider1 = GUICtrlCreateSlider (10,10,200,20)
GUICtrlSetLimit(-1,200,0) ; change min/max value
$button = GUICtrlCreateButton ("Value?",75,50,70,20)
GUISetState()
GUICtrlSetData($slider1,45) ; set cursor
$h_slider = ControlGetHandle($Gui_Slider, "", "msctls_trackbar321")
$Status = GUICtrlCreateLabel("Pos: " & _GUICtrlSliderGetPos($h_slider), 0, 80, 220, 20, BitOR($SS_SUNKEN, $SS_CENTER))

While 1
$msg = GUIGetMsg ()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
GUICtrlSetData($Status,"Pos: " & _GUICtrlSliderGetPos($h_slider))
EndSelect
WEnd


Function _GUICtrlSliderGetRangeMax

Function Reference

_GUICtrlSliderGetRangeMax

Retrieves the maximum position for the slider.

#Include <GuiSlider.au3>
_GUICtrlSliderGetRangeMax($h_slider)

Parameters

$h_slider handle of the control

Return Value

Returns a value that specifies the maximum position in the slider's range of minimum to maximum slider positions.

Remarks

None.

Related

_GUICtrlSliderGetRangeMin

Example

#include <GUIConstants.au3>
#include <GuiSlider.au3>

opt('MustDeclareVars', 1)

Dim $Gui_Slider, $slider1, $msg, $h_slider, $Status

$Gui_Slider = GUICreate("Slider Get Range Max", 220, 100, 100, 200)
GUISetBkColor(0x00E0FFFF) ; will change background color

$slider1 = GUICtrlCreateSlider(10, 10, 200, 20)
GUICtrlSetLimit(-1, 220, 20) ; change min/max value
GUISetState()
GUICtrlSetData($slider1, 45) ; set cursor
$h_slider = ControlGetHandle($Gui_Slider, "", "msctls_trackbar321")
$Status = GUICtrlCreateLabel("Max: " & _GUICtrlSliderGetRangeMax ($h_slider), 0, 80, 220, 20, BitOR($SS_SUNKEN, $SS_CENTER))
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlSliderGetRangeMin

Function Reference

_GUICtrlSliderGetRangeMin

Retrieves the minimum position for the slider.

#Include <GuiSlider.au3>
_GUICtrlSliderGetRangeMin($h_slider)

Parameters

$h_slider handle of the control

Return Value

Returns a value that specifies the minimum position in the slider's range of minimum to maximum slider positions.

Remarks

None.

Related

_GUICtrlSliderGetRangeMax

Example

#include <GUIConstants.au3>
#include <GuiSlider.au3>

opt('MustDeclareVars', 1)

Dim $Gui_Slider, $slider1, $msg, $h_slider, $Status

$Gui_Slider = GUICreate("Slider Get Range Min", 220, 100, 100, 200)
GUISetBkColor(0x00E0FFFF) ; will change background color

$slider1 = GUICtrlCreateSlider(10, 10, 200, 20)
GUICtrlSetLimit(-1, 220, 20) ; change min/max value
GUISetState()
GUICtrlSetData($slider1, 45) ; set cursor
$h_slider = ControlGetHandle($Gui_Slider, "", "msctls_trackbar321")
$Status = GUICtrlCreateLabel("Min: " & _GUICtrlSliderGetRangeMin ($h_slider), 0, 80, 220, 20, BitOR($SS_SUNKEN, $SS_CENTER))
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlSliderSetLineSize

Function Reference

_GUICtrlSliderSetLineSize

Sets the number of logical positions the slider moves.

#Include <GuiSlider.au3>
_GUICtrlSliderSetLineSize($h_slider, $i_linesize)

Parameters

$h_slider | handle of the control
$i_linesize | New line size

Return Value

Returns a value that specifies the previous line size.

Remarks

Sets the number of logical positions the slider moves in response to keyboard input from the arrow keys.
The logical positions are the integer increments in the slider's range of minimum to maximum slider positions.

Related

_GUICtrlSliderGetLineSize

Example

#include <GUIConstants.au3>
#include <GuiSlider.au3>

opt('MustDeclareVars', 1)

Dim $Gui_Slider, $slider1, $button, $msg, $h_slider, $Status

$Gui_Slider = GUICreate("Slider Set Line Size", 220, 100, 100, 200)
GUISetBkColor(0x00E0FFFF) ; will change background color

$slider1 = GUICtrlCreateSlider(10, 10, 200, 20)
GUICtrlSetLimit(-1, 200, 0) ; change min/max value
$button = GUICtrlCreateButton("Set Line Size", 75, 55, 70, 20)
GUISetState()
GUICtrlSetData($slider1, 45) ; set cursor
$h_slider = ControlGetHandle($Gui_Slider, "", "msctls_trackbar321")
$Status = GUICtrlCreateLabel("Line Size: " & _GUICtrlSliderGetLineSize ($h_slider), 0, 80, 220, 20, BitOR($SS_SUNKEN, $SS_CENTER))
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
_GUICtrlSliderSetLineSize ($h_slider, 10)
GUICtrlSetData($Status, "Line Size: " & _GUICtrlSliderGetLineSize ($h_slider))
EndSelect
WEnd


Function _GUICtrlSliderSetPageSize

Function Reference

_GUICtrlSliderSetPageSize

Sets the number of logical positions the slider moves.

#Include <GuiSlider.au3>
_GUICtrlSliderSetPageSize($h_slider, $i_pagesize)

Parameters

$h_slider | handle of the control
$i_pagesize | New page size

Return Value

Returns a value that specifies the previous page size.

Remarks

Sets the number of logical positions the slider moves in response to keyboard input,
or mouse input, such as clicks in the slider's channel.
The logical positions are the integer increments in the slider's range of minimum to maximum slider positions.

Related

_GUICtrlSliderGetPageSize

Example

#include <GUIConstants.au3>
#include <GuiSlider.au3>

opt('MustDeclareVars', 1)

Dim $Gui_Slider, $slider1, $button, $msg, $h_slider, $Status

$Gui_Slider = GUICreate("Slider Set Page Size", 220, 100, 100, 200)
GUISetBkColor(0x00E0FFFF) ; will change background color

$slider1 = GUICtrlCreateSlider(10, 10, 200, 20)
GUICtrlSetLimit(-1, 200, 0) ; change min/max value
$button = GUICtrlCreateButton("Set Page Size", 75, 55, 75, 20)
GUISetState()
GUICtrlSetData($slider1, 45) ; set cursor
$h_slider = ControlGetHandle($Gui_Slider, "", "msctls_trackbar321")
$Status = GUICtrlCreateLabel("Page Size: " & _GUICtrlSliderGetPageSize ($h_slider), 0, 80, 220, 20, BitOR($SS_SUNKEN, $SS_CENTER))
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
_GUICtrlSliderSetPageSize ($h_slider, 10)
GUICtrlSetData($Status, "Page Size: " & _GUICtrlSliderGetPageSize ($h_slider))
EndSelect
WEnd


Function _GUICtrlSliderSetPos

Function Reference

_GUICtrlSliderSetPos

Sets the current logical position of the slider.

#Include <GuiSlider.au3>
_GUICtrlSliderSetPos($h_slider, $i_pos)

Parameters

$h_slider | handle of the control
$i_pos | New logical position of the slider

Return Value

None.

Remarks

None.

Related

None.

Example

#include <GUIConstants.au3>
#include <GuiSlider.au3>

opt('MustDeclareVars', 1)

Dim $Gui_Slider, $slider1, $button, $msg, $h_slider, $Status, $Pos = 0

$Gui_Slider = GUICreate("Slider Set Pos", 220, 100, 100, 200)
GUISetBkColor(0x00E0FFFF) ; will change background color

$slider1 = GUICtrlCreateSlider(10, 10, 200, 20)
GUICtrlSetLimit(-1, 200, 0) ; change min/max value
$button = GUICtrlCreateButton("Set Pos", 75, 55, 75, 20)
GUISetState()
GUICtrlSetData($slider1, 45) ; set cursor
$h_slider = ControlGetHandle($Gui_Slider, "", "msctls_trackbar321")
$Status = GUICtrlCreateLabel("Pos: " & GUICtrlRead($slider1), 0, 80, 220, 20, BitOR($SS_SUNKEN, $SS_CENTER))
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$Pos += 10
If $Pos > 200 Then
$Pos = 10
EndIf
_GUICtrlSliderSetPos ($h_slider, $Pos)
GUICtrlSetData($Status, "Pos: " & GUICtrlRead($slider1))
EndSelect
WEnd


Function _GUICtrlSliderSetTicFreq

Function Reference

_GUICtrlSliderSetTicFreq

Sets the interval frequency for tick marks in a slider.

#Include <GuiSlider.au3>
_GUICtrlSliderSetTicFreq($h_slider, $i_freq)

Parameters

$h_slider | handle of the control
$i_freq | Frequency of the tick marks

Return Value

None.

Remarks

The slider must have the $TBS_AUTOTICKS style to use this.

Related

_GUICtrlSliderGetNumTics

Example

#include <GUIConstants.au3>
#include <GuiSlider.au3>

opt('MustDeclareVars', 1)

Dim $Gui_Slider, $slider1, $button, $msg, $h_slider, $Status

$Gui_Slider = GUICreate("Slider Set Tic Freq", 220, 100, 100, 200)
GUISetBkColor(0x00E0FFFF) ; will change background color

$slider1 = GUICtrlCreateSlider(10, 10, 200, 20)
GUICtrlSetLimit(-1, 200, 0) ; change min/max value
$button = GUICtrlCreateButton("Set Freq", 75, 55, 70, 20)
GUISetState()
GUICtrlSetData($slider1, 45) ; set cursor
$h_slider = ControlGetHandle($Gui_Slider, "", "msctls_trackbar321")
$Status = GUICtrlCreateLabel("Num of Tics: " & _GUICtrlSliderGetNumTics ($h_slider), 0, 80, 220, 20, BitOR($SS_SUNKEN, $SS_CENTER))
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
_GUICtrlSliderSetTicFreq ($h_slider, 5)
GUICtrlSetData($Status, "Num of Tics: " & _GUICtrlSliderGetNumTics ($h_slider))
EndSelect
WEnd


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: GuiStatusBar Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_GUICtrlStatusBarCreate | Creates Statusbar
_GUICtrlStatusBarGetBorders | Gets width of the borders.
_GUICtrlStatusBarGetIcon | Gets Statusbar panel Icon handle.
_GUICtrlStatusBarGetParts | Retrieves a count of the parts in a status window.
_GUICtrlStatusBarGetRect | Retrieves the bounding rectangle of a part in a status window.
_GUICtrlStatusBarGetText | Gets Statusbar Text from a part.
_GUICtrlStatusBarGetTextLength | Retrieves the length, in characters, of the text from the specified part of a status window.
_GUICtrlStatusBarGetTip | Gets Statusbar TipText.
_GUICtrlStatusBarGetUnicode | Retrieves the Unicode character format flag for the control.
_GUICtrlStatusBarResize | Resize Statusbar.
_GUICtrlStatusBarSetBKColor | Sets the background color in a status bar.
_GUICtrlStatusBarSetIcon | Sets an Icon in the Panel.
_GUICtrlStatusBarSetMinHeight | Sets the minimum height of a status window's drawing area.
_GUICtrlStatusBarSetSimple | Specifies whether a status window displays simple text or displays all window parts.
_GUICtrlStatusBarSetText | Sets the text in the specified part of a status window.
_GUICtrlStatusBarSetTip | Sets the ToolTip text for a part in a status bar.
_GUICtrlStatusBarSetUnicode | Sets the Unicode character format flag for the control.


Function _GUICtrlStatusBarCreate

Function Reference

_GUICtrlStatusBarCreate

Creates Statusbar

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarCreate($h_Gui, $a_PanelWidth, $s_PanelText[, $v_styles = ""])

Parameters

$h_Gui | Handle to parent window
$a_PanelWidth | width of panel or panels (for more than 1 panel pass in zero based array)
$s_PanelText | text of panel or panels (for more than 1 panel pass in zero based array)
$v_styles | styles to apply to the status bar (Optional) for multiple styles bitor them.

Return Value

Returns hWhnd if successful, or 0 with error set to 1 otherwise.

Remarks

None.

Related

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Create", 500, -1, -1, -1, $WS_SIZEBOX)
$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


Function _GUICtrlStatusBarGetBorders

Function Reference

_GUICtrlStatusBarGetBorders

Gets width of the borders.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarGetBorders($h_StatusBar)

Parameters

$h_StatusBar Handle to statusbar

Return Value

Returns zero based array
0 - width of the horizontal border
1 - width of the vertical border
2 - width of the border between rectangles
or zero otherwise.

Remarks

None.

Related

None.

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg
Local $a_PartsRightEdge[3] = [150, 300, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Get Border Widths", 500, -1, -1, -1, $WS_SIZEBOX)
$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)

Local $a_borders = _GUICtrlStatusBarGetBorders($StatusBar1)
If IsArray($a_borders) Then
_GUICtrlStatusBarSetText($StatusBar1, "horizontal border: " & $a_borders[0], 0)
_GUICtrlStatusBarSetText($StatusBar1, "vertical border: " & $a_borders[1], 1)
_GUICtrlStatusBarSetText($StatusBar1, "between rectangles: " & $a_borders[2], 2)
EndIf

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


Function _GUICtrlStatusBarGetIcon

Function Reference

_GUICtrlStatusBarGetIcon

Gets Statusbar panel Icon handle.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarGetIcon($h_StatusBar[, $i_Panel=0])

Parameters

$h_StatusBar | The Control Id (will be converted to hWnd)
$i_Panel | Optional: The panel to hold the text (Default = 0)

Return Value

return hwnd or zero otherwise.

Remarks

None.

Related

_GUICtrlStatusBarSetIcon

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Get Icon", 500, -1, -1, -1, $WS_SIZEBOX)

$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)
_GUICtrlStatusBarSetIcon($StatusBar1, 1, "shell32.dll", 168)
_GUICtrlStatusBarSetIcon($StatusBar1, 0, "shell32.dll", 21)
_GUICtrlStatusBarSetIcon($StatusBar1, 2, "shell32.dll", 24)

_GUICtrlStatusBarSetText($StatusBar1, _GUICtrlStatusBarGetIcon($StatusBar1, 0), 0)
_GUICtrlStatusBarSetText($StatusBar1, _GUICtrlStatusBarGetIcon($StatusBar1, 1), 1)
_GUICtrlStatusBarSetText($StatusBar1, _GUICtrlStatusBarGetIcon($StatusBar1, 2), 2)

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


Function _GUICtrlStatusBarGetParts

Function Reference

_GUICtrlStatusBarGetParts

Retrieves a count of the parts in a status window.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarGetParts($h_StatusBar)

Parameters

$h_StatusBar The Control Id (will be converted to hWnd if it isn't)

Return Value

Returns the number of parts in the window, otherwise zero.

Remarks

None.

Related

_GUICtrlStatusBarCreate

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg, $lbl_Parts
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Get Parts", 500, -1, -1, -1, $WS_SIZEBOX)
$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)
$lbl_Parts = GUICtrlCreateLabel("Number of Parts: " & _GUICtrlStatusBarGetParts($StatusBar1),10,10,100,25,$SS_SUNKEN )

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


Function _GUICtrlStatusBarGetRect

Function Reference

_GUICtrlStatusBarGetRect

Retrieves the bounding rectangle of a part in a status window.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarGetRect($StatusBar, $i_part)

Parameters

$h_StatusBar | Handle to statusbar
$i_part | zero based index of panel to retrieve rectangle from

Return Value

Returns zero based array
0 - Left
1 - Top
2 - Right
3 - Bottom
zero otherwise.

Remarks

None.

Related

None.

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg
Local $a_PartsRightEdge[4] = [100, 200, 350, -1]
Local $a_PartsText[4] = ["New Text", "More Text", "Even More Text", "Hey some more"]

$gui = GUICreate("Status Bar Get Rect", 500, -1, -1, -1, $WS_SIZEBOX)
$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)

Local $a_rect = _GUICtrlStatusBarGetRect ($StatusBar1, 1)
If IsArray($a_rect) Then
_GUICtrlStatusBarSetText ($StatusBar1, "Left: " & $a_rect[0], 0)
_GUICtrlStatusBarSetText ($StatusBar1, "Top: " & $a_rect[1], 1)
_GUICtrlStatusBarSetText ($StatusBar1, "Right: " & $a_rect[2], 2)
_GUICtrlStatusBarSetText ($StatusBar1, "Bottom: " & $a_rect[3], 3)
EndIf

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


Function _GUICtrlStatusBarGetText

Function Reference

_GUICtrlStatusBarGetText

Gets Statusbar Text from a part.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarGetText($h_StatusBar[,$i_Panel=0])

Parameters

$h_StatusBar | The Control Id (will be converted to hWnd if isn't)
$i_Panel | Optional: The panel (part) to retreive the text from (zero based) (Default = 0)

Return Value

Text from panel

Remarks

None.

Related

_GUICtrlStatusBarCreate, _GUICtrlStatusBarSetText

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg, $lbl_Info
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Get Text", 500, -1, -1, -1, $WS_SIZEBOX)
$lbl_Info = GUICtrlCreateLabel("", 10, 10, 150, 50, $SS_SUNKEN)
$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)

GUICtrlSetData($lbl_Info, "1st Part: " & _GUICtrlStatusBarGetText ($StatusBar1, 0) & @LF & _
"2nd Part: " & _GUICtrlStatusBarGetText ($StatusBar1, 1) & @LF & _
"3rd Part: " & _GUICtrlStatusBarGetText ($StatusBar1, 2))

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


Function _GUICtrlStatusBarGetTextLength

Function Reference

_GUICtrlStatusBarGetTextLength

Retrieves the length, in characters, of the text from the specified part of a status window.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarGetTextLength ($h_StatusBar, $i_Panel)

Parameters

$h_StatusBar | The Control Id (will be converted to hWnd)
$i_Panel | Nubmer of the panel to retrieve length from (zero based)

Return Value

Text Length

Remarks

None.

Related

_GUICtrlStatusBarCreate, _GUICtrlStatusBarSetText

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg, $lbl_Info
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Get Text Length", 500, -1, -1, -1, $WS_SIZEBOX)
$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)
$lbl_Info = GUICtrlCreateLabel("Text Length of 3rd Part: " & _GUICtrlStatusBarGetTextLength ($StatusBar1, 2), 10, 10, 150, 20)

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


Function _GUICtrlStatusBarGetTip

Function Reference

_GUICtrlStatusBarGetTip

Gets Statusbar TipText.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarGetTip($h_StatusBar[, $i_Panel=0])

Parameters

$h_StatusBar | The Control Id (will be converted to hWnd)
$i_Panel | Optional: The panel to retreive the text from (Default: 0)

Return Value

Tip Text, on error empty string and @error is set to 1

Remarks

The status bar must be created with the $SBT_TOOLTIPS style to enable ToolTips.

This ToolTip text is displayed in two situations:

When the corresponding pane in the status bar contains only an icon.
When the corresponding pane in the status bar contains text that is truncated due to the size of the pane.

Related

_GUICtrlStatusBarCreate, _GUICtrlStatusBarSetTip

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg, $lbl_Info
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Get Tip Text", 500, -1, -1, -1, $WS_SIZEBOX)

$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, "", $SBT_TOOLTIPS)

_GUICtrlStatusBarSetIcon ($StatusBar1, 1, "shell32.dll", 168)
_GUICtrlStatusBarSetIcon ($StatusBar1, 0, "shell32.dll", 21)
_GUICtrlStatusBarSetIcon ($StatusBar1, 2, "shell32.dll", 24)

_GUICtrlStatusBarSetTip ($StatusBar1, 0, "Part 1")
_GUICtrlStatusBarSetTip ($StatusBar1, 1, "This is a Tip for the status bar")
_GUICtrlStatusBarSetTip ($StatusBar1, 2, "Part 3")

$lbl_Info = GUICtrlCreateLabel("Tip Text of 2nd Part: " & _GUICtrlStatusBarGetTip ($StatusBar1, 1), 10, 10, 250, 20)

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


Function _GUICtrlStatusBarGetUnicode

Function Reference

_GUICtrlStatusBarGetUnicode

Retrieves the Unicode character format flag for the control.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarGetUnicode ($h_StatusBar)

Parameters

$h_StatusBar The Control Id (will be converted to hWnd)

Return Value

If this value is nonzero, the control is using Unicode characters.
If this value is zero, the control is using ANSI characters.

Remarks

None.

Related

_GUICtrlStatusBarSetUnicode

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Get Unicode", 500, -1, -1, -1, $WS_SIZEBOX)

$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)

If _GUICtrlStatusBarGetUnicode ($StatusBar1) Then
_GUICtrlStatusBarSetText ($StatusBar1, "Using Unicode characters", 1)
Else
_GUICtrlStatusBarSetText ($StatusBar1, "NOT using Unicode characters", 1)
EndIf

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


Function _GUICtrlStatusBarResize

Function Reference

_GUICtrlStatusBarResize

Resize Statusbar.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarResize($h_StatusBar)

Parameters

$h_StatusBar The Control Id (will be converted to hWnd)

Return Value

If the function succeeds, the return value is nonzero, otherwise zero.

Remarks

None.

Related

_GUICtrlStatusBarSetMinHeight

Example

Opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Global $StatusBar2

_Example_1()
_Example_2()

Func _Example_1()

Local $gui, $StatusBar1, $msg
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Resize", 500, -1, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SYSMENU, $WS_SIZEBOX, $WS_MAXIMIZEBOX))

$StatusBar1 = _GUICtrlStatusBarCreate($gui, $a_PartsRightEdge, $a_PartsText)

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED Or $msg = $GUI_EVENT_MINIMIZE Or $msg = $GUI_EVENT_MAXIMIZE Or $msg = $GUI_EVENT_RESTORE
_GUICtrlStatusBarResize($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd
GUIDelete()
EndFunc ;==>_Example_1

Func _Example_2()
Local $gui, $msg
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Resize", 500, -1, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SYSMENU, $WS_SIZEBOX, $WS_MAXIMIZEBOX))

$StatusBar2 = _GUICtrlStatusBarCreate($gui, $a_PartsRightEdge, $a_PartsText)

;$WM_SIZE/$WM_SIZING are defined in GuiStatusBar.au3
GUIRegisterMsg($WM_SIZING, "WM_SIZING"); handle resize
GUIRegisterMsg($WM_SIZE, "WM_SIZING"); button maximize

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd
GUIDelete()
EndFunc ;==>_Example_2

Func WM_SIZING()
Return _GUICtrlStatusBarResize($StatusBar2)
EndFunc ;==>WM_SIZING


Function _GUICtrlStatusBarSetBKColor

Function Reference

_GUICtrlStatusBarSetBKColor

Sets the background color in a status bar.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarSetBKColor($h_StatusBar, $v_HexRGB)

Parameters

$h_StatusBar | Handle to statusbar
$v_HexRGB | Hex RGB color to set Status Bar background

Return Value

Returns the previous background color or zero upon failure

Remarks

None.

Related

None.

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]
Local Const $Yellow = 0xffff00

$gui = GUICreate("Status Bar Set Back Color", 500, -1, -1, -1, $WS_SIZEBOX)

$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)
_GUICtrlStatusBarSetBKColor ($StatusBar1, $Yellow)

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


Function _GUICtrlStatusBarSetIcon

Function Reference

_GUICtrlStatusBarSetIcon

Sets an Icon in the Panel.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarSetIcon($StatusBar, $i_part, $szIconFile, $iconID)

Parameters

$h_StatusBar | Handle to statusbar
$i_part | Nubmer of panel to add icon too
$s_IconFile | file to extract icon from
$i_iconID | id of the icon

Return Value

Returns nonzero if successful, or zero otherwise.

Remarks

None.

Related

_GUICtrlStatusBarGetIcon

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Set Icon", 500, -1, -1, -1, $WS_SIZEBOX)
$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)

_GUICtrlStatusBarSetIcon($StatusBar1, 1, "shell32.dll", 168)
_GUICtrlStatusBarSetIcon($StatusBar1, 0, "shell32.dll", 21)
_GUICtrlStatusBarSetIcon($StatusBar1, 2, "shell32.dll", 24)

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


Function _GUICtrlStatusBarSetMinHeight

Function Reference

_GUICtrlStatusBarSetMinHeight

Sets the minimum height of a status window's drawing area.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarSetMinHeight($h_StatusBar, $i_MinHeight)

Parameters

$h_StatusBar | Handle to statusbar
$i_MinHeight | Minimum height, in pixels, of the window

Return Value

None.

Remarks

None.

Related

_GUICtrlStatusBarResize

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Set Min Height", 500, -1, -1, -1, $WS_SIZEBOX)

$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)
_GUICtrlStatusBarSetMinHeight($StatusBar1, 30)

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


Function _GUICtrlStatusBarSetSimple

Function Reference

_GUICtrlStatusBarSetSimple

Specifies whether a status window displays simple text or displays all window parts.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarSetSimple($h_StatusBar[, $b_Simple = True])

Parameters

$h_StatusBar | Handle to statusbar
$b_Simple | Display type flag. If this parameter is TRUE, the window displays simple text. (Default) If it is FALSE, it displays multiple parts

Return Value

None.

Remarks

None.

Related

_GUICtrlStatusBarCreate

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Set Simple", 500, -1, -1, -1, $WS_SIZEBOX)

$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)

GUISetState(@SW_SHOW)

Sleep(3000)
_GUICtrlStatusBarSetSimple($StatusBar1)
_GUICtrlStatusBarSetText ($StatusBar1, "simple mode", 255)
_GUICtrlStatusBarResize ($StatusBar1)
Sleep(3000)
_GUICtrlStatusBarSetSimple($StatusBar1, False)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


Function _GUICtrlStatusBarSetText

Function Reference

_GUICtrlStatusBarSetText

Sets the text in the specified part of a status window.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarSetText($h_StatusBar[, $s_Data = ""[, $i_Panel = 0]])

Parameters

$h_StatusBar | The Control Id (will be converted to hWnd)
$s_Data | The text to display in the panel
$i_Panel | Optional: The panel to hold the text (Default: 0)

Return Value

Returns TRUE if successful, or FALSE otherwise.

Remarks

None.

Related

_GUICtrlStatusBarCreate, _GUICtrlStatusBarGetText

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Set Text", 500, -1, -1, -1, $WS_SIZEBOX)

$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)
_GUICtrlStatusBarSetText ($StatusBar1, "Text has been set", 1)

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


Function _GUICtrlStatusBarSetTip

Function Reference

_GUICtrlStatusBarSetTip

Sets the ToolTip text for a part in a status bar.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarSetTip($h_StatusBar, $i_part, $s_ToolTip)

Parameters

$h_StatusBar | Handle to statusbar
$i_part | Zero-based index of the part that will receive the ToolTip text
$s_ToolTip | new ToolTip text

Return Value

None.

Remarks

The status bar must be created with the $SBT_TOOLTIPS style to enable ToolTips.

This ToolTip text is displayed in two situations:

When the corresponding pane in the status bar contains only an icon.
When the corresponding pane in the status bar contains text that is truncated due to the size of the pane.

Related

_GUICtrlStatusBarCreate, _GUICtrlStatusBarGetTip

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg
Local $a_PartsRightEdge[3] = [100, 200, -1]
Local $a_PartsText[3] = ["", "Force tip to be shown when text is more than fits in the box", "Even More Text"]

$gui = GUICreate("Status Bar Set Tip", 500, -1, -1, -1, $WS_SIZEBOX)

$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText, $SBT_TOOLTIPS)
_GUICtrlStatusBarSetIcon($StatusBar1, 0, "shell32.dll", 21)
_GUICtrlStatusBarSetTip($StatusBar1, 0, "Tip works when only icon in part or text exceeds part")
_GUICtrlStatusBarSetTip($StatusBar1, 1, "Force tip to be shown when text is more than fits in the box")
_GUICtrlStatusBarSetTip($StatusBar1, 2, "Part 3")

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


Function _GUICtrlStatusBarSetUnicode

Function Reference

_GUICtrlStatusBarSetUnicode

Sets the Unicode character format flag for the control.

#Include <GuiStatusBar.au3>
_GUICtrlStatusBarSetUnicode($h_StatusBar[, $b_Unicode = True[)

Parameters

$h_StatusBar | Handle to statusbar
$b_Unicode | Optional: Determines the character set that is used by the control. If this value is TRUE, the control will use Unicode characters. (Default) If this value is FALSE, the control will use ANSI characters.

Return Value

Returns the previous Unicode format flag for the control

Remarks

None.

Related

_GUICtrlStatusBarGetUnicode

Example

opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

Local $gui, $StatusBar1, $msg
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Set Unicode", 500, -1, -1, -1, $WS_SIZEBOX)

$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)

_GUICtrlStatusBarSetUnicode($StatusBar1, False)
If _GUICtrlStatusBarGetUnicode($StatusBar1) Then
_GUICtrlStatusBarSetText ($StatusBar1, "using Unicode characters", 1)
Else
_GUICtrlStatusBarSetText ($StatusBar1, "NOT using Unicode characters", 1)
EndIf

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_RESIZED
_GUICtrlStatusBarResize ($StatusBar1)
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;
EndSelect

WEnd


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: GuiTab Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_GUICtrlTabDeleteAllItems | Removes all items from a tab control.
_GUICtrlTabDeleteItem | Removes an item from a tab control.
_GUICtrlTabDeselectAll | Resets items in a tab control.
_GUICtrlTabGetCurFocus | Returns the index of the item that has the focus in a tab control.
_GUICtrlTabGetCurSel | Determines the currently selected tab in a tab control.
_GUICtrlTabGetExtendedStyle | Retrieves the extended styles that are currently in use for the tab control.
_GUICtrlTabGetItemCount | Retrieves the number of tabs in the tab control.
_GUICtrlTabGetItemRECT | Retrieves the bounding rectangle for a tab in a tab control.
_GUICtrlTabGetRowCount | Retrieves the current number of rows of tabs in a tab control.
_GUICtrlTabGetUnicodeFormat | Retrieves the Unicode character format flag for the control.
_GUICtrlTabHighlightItem | Sets the highlight state of a tab item.
_GUICtrlTabSetCurFocus | Sets the focus to a specified tab in a tab control.
_GUICtrlTabSetCurSel | Selects a tab in a tab control.
_GUICtrlTabSetMinTabWidth | Sets the minimum width of items in a tab control.
_GUICtrlTabSetUnicodeFormat | Sets the Unicode character format flag for the control.


Function _GUICtrlTabDeleteAllItems

Function Reference

_GUICtrlTabDeleteAllItems

Removes all items from a tab control.

#Include <GuiTab.au3>
_GUICtrlTabDeleteAllItems($h_tabcontrol)

Parameters

$h_tabcontrol control id/control hWnd

Return Value

Returns TRUE if successful, or FALSE otherwise.

Remarks

This does not delete the controls on the tabitems

Related

_GUICtrlTabDeleteItem

Example

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab0OK, $tab0input, $tab1, $tab1combo, $tab1OK, $tab2, $tab2OK, $tab3, $tab4, $button, $msg
GUICreate("Tab Delete All Items", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100, $TCS_MULTILINE)

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 60, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 60, 70, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 60, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 60, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 60, 50)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab3 = GUICtrlCreateTabItem("tab3")
GUICtrlCreateTabItem("") ; end tabitem definition

$tab4 = GUICtrlCreateTabItem("tab4")
GUICtrlCreateTabItem("") ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)
$button = GUICtrlCreateButton("Delete All", 200, 130, 90, 30)

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
_GUICtrlTabDeleteAllItems ($tab)
EndSelect
WEnd


Function _GUICtrlTabDeleteItem

Function Reference

_GUICtrlTabDeleteItem

Removes an item from a tab control.

#Include <GuiTab.au3>
_GUICtrlTabDeleteItem($h_tabcontrol, $i_item)

Parameters

$h_tabcontrol | control id/control hWnd
$i_item | Index of the item to delete.

Return Value

Returns TRUE if successful, or FALSE otherwise.

Remarks

This does not delete the controls on the tabitem.

Related

_GUICtrlTabDeleteAllItems

Example

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab0OK, $tab0input, $tab1, $tab1combo, $tab1OK, $tab2, $tab2OK, $tab3, $tab4, $button, $msg

GUICreate("Tab Delete Item", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100, $TCS_MULTILINE)

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 60, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 60, 70, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 60, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 60, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 60, 50)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab3 = GUICtrlCreateTabItem("tab3")
GUICtrlCreateTabItem("") ; end tabitem definition

$tab4 = GUICtrlCreateTabItem("tab4")
GUICtrlCreateTabItem("") ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)
$button = GUICtrlCreateButton("Delete", 200, 130, 90, 30)

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
_GUICtrlTabDeleteItem ($tab, 2)
EndSelect
WEnd


Function _GUICtrlTabDeselectAll

Function Reference

_GUICtrlTabDeselectAll

Resets items in a tab control.

#Include <GuiTab.au3>
_GUICtrlTabDeselectAll($h_tabcontrol, $i_bool)

Parameters

$h_tabcontrol | control id/control hWnd
$i_bool | Flag that specifies the scope of the item deselection. If this parameter is set to FALSE, all tab items will be reset. If it is set to TRUE, then all tab items except for the one currently selected will be reset.

Return Value

None.

Remarks

This only works if $TCS_BUTTONS style flag has been set.

Related

_GUICtrlTabGetCurSel, _GUICtrlTabSetCurSel

Example

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab0OK, $tab0input, $tab1, $tab1combo, $tab1OK, $tab2, $tab2OK, $tab3, $tab4, $button, $msg

GUICreate("Tab Deselect All", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100, BitOR($TCS_BUTTONS, $TCS_MULTILINE))

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 60, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 60, 70, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 60, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 60, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 60, 50)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab3 = GUICtrlCreateTabItem("tab3")
GUICtrlCreateTabItem("") ; end tabitem definition

$tab4 = GUICtrlCreateTabItem("tab4")
GUICtrlCreateTabItem("") ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)
$button = GUICtrlCreateButton("Deselect All", 200, 130, 90, 30)

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
_GUICtrlTabDeselectAll ($tab, 0)
EndSelect
WEnd


Function _GUICtrlTabGetCurFocus

Function Reference

_GUICtrlTabGetCurFocus

Returns the index of the item that has the focus in a tab control.

#Include <GuiTab.au3>
_GUICtrlTabGetCurFocus($h_tabcontrol)

Parameters

$h_tabcontrol control id/control hWnd

Return Value

Returns the index of the tab item that has the focus.

Remarks

The item that has the focus may be different than the selected item.

Related

_GUICtrlTabSetCurFocus

Example

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab0OK, $tab0input, $tab1, $tab1combo, $tab1OK, $tab2, $tab2OK, $tab3, $tab4
Dim $msg, $Status, $current

GUICreate("Tab Get Current Focus", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100, BitOR($TCS_FLATBUTTONS, $TCS_MULTILINE), $TCS_EX_FLATSEPARATORS)

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 60, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 60, 70, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 60, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 60, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 60, 50)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab3 = GUICtrlCreateTabItem("tab3")
GUICtrlCreateTabItem("") ; end tabitem definition

$tab4 = GUICtrlCreateTabItem("tab4")
GUICtrlCreateTabItem("") ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)
$Status = GUICtrlCreateLabel("", 0, 180, 300, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()

$current = _GUICtrlTabGetCurFocus ($tab)
GUICtrlSetData($Status, "Items Current Focus: " & $current)

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If ($current <> _GUICtrlTabGetCurFocus ($tab)) Then
$current = _GUICtrlTabGetCurFocus ($tab)
GUICtrlSetData($Status, "Items Current Focus: " & $current)
EndIf
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlTabGetCurSel

Function Reference

_GUICtrlTabGetCurSel

Determines the currently selected tab in a tab control.

#Include <GuiTab.au3>
_GUICtrlTabGetCurSel($h_tabcontrol)

Parameters

$h_tabcontrol control id/control hWnd

Return Value

Returns the index of the selected tab if successful, or $TC_ERR if no tab is selected.

Remarks

None.

Related

_GUICtrlTabSetCurSel

Example

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab0OK, $tab0input, $tab1, $tab1combo, $tab1OK, $tab2, $tab2OK, $tab3, $tab4
Dim $msg, $Status, $current, $button

GUICreate("Tab Get Current Selection", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100, $TCS_MULTILINE)

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 60, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 60, 70, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 60, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 60, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 60, 50)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab3 = GUICtrlCreateTabItem("tab3")
GUICtrlCreateTabItem("") ; end tabitem definition

$tab4 = GUICtrlCreateTabItem("tab4")
GUICtrlCreateTabItem("") ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)

$Status = GUICtrlCreateLabel("", 0, 180, 300, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
GUICtrlSetData($Status, "Current Selection: " & _GUICtrlTabGetCurSel ($tab))

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $tab
GUICtrlSetData($Status, "Current Selection: " & _GUICtrlTabGetCurSel ($tab))
EndSelect
WEnd


Function _GUICtrlTabGetExtendedStyle

Function Reference

_GUICtrlTabGetExtendedStyle

Retrieves the extended styles that are currently in use for the tab control.

#Include <GuiTab.au3>
_GUICtrlTabGetExtendedStyle($h_tabcontrol)

Parameters

$h_tabcontrol control id/control hWnd

Return Value

Returns a DWORD value that represents the extended styles currently
in use for the tab control.
This value is a combination of tab control extended styles.

Remarks

None.

Related

None.

Example

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab0OK, $tab0input, $tab1, $tab1combo, $tab1OK, $tab2, $tab2OK, $tab3, $tab4
Dim $msg, $Styles, $i

GUICreate("Tab Get Extended Style", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100, BitOR($TCS_FLATBUTTONS, $TCS_MULTILINE), $TCS_EX_FLATSEPARATORS)

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 60, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 60, 70, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 60, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 60, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 60, 50)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab3 = GUICtrlCreateTabItem("tab3")
GUICtrlCreateTabItem("") ; end tabitem definition

$tab4 = GUICtrlCreateTabItem("tab4")
GUICtrlCreateTabItem("") ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)

GUISetState()
$Styles = ""
For $i = 1 To 2
Select
Case $i = 1
If (BitAND(_GUICtrlTabGetExtendedStyle ($tab), $TCS_EX_FLATSEPARATORS) = $TCS_EX_FLATSEPARATORS) Then
$Styles &= "$TCS_EX_FLATSEPARATORS" & @LF
EndIf
Case $i = 2
If (BitAND(_GUICtrlTabGetExtendedStyle ($tab), $TCS_EX_REGISTERDROP) = $TCS_EX_REGISTERDROP) Then
$Styles &= "$TCS_EX_REGISTERDROP" & @LF
EndIf
EndSelect
Next
If ($Styles) Then
MsgBox(0, "Extend Styles found", $Styles)
EndIf

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlTabGetItemCount

Function Reference

_GUICtrlTabGetItemCount

Retrieves the number of tabs in the tab control.

#Include <GuiTab.au3>
_GUICtrlTabGetItemCount($h_tabcontrol)

Parameters

$h_tabcontrol control id/control hWnd

Return Value

Returns the number of items if successful, or zero otherwise.

Remarks

None.

Related

_GUICtrlTabGetRowCount

Example

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab0OK, $tab0input, $tab1, $tab1combo, $tab1OK, $tab2, $tab2OK, $tab3, $tab4
Dim $msg, $Status

GUICreate("Tab Get Item Count", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100, BitOR($TCS_FLATBUTTONS, $TCS_MULTILINE), $TCS_EX_FLATSEPARATORS)

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 60, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 60, 70, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 60, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 60, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 60, 50)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab3 = GUICtrlCreateTabItem("tab3")
GUICtrlCreateTabItem("") ; end tabitem definition

$tab4 = GUICtrlCreateTabItem("tab4")
GUICtrlCreateTabItem("") ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)

$Status = GUICtrlCreateLabel("", 0, 180, 300, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
GUICtrlSetData($Status, "Items: " & _GUICtrlTabGetItemCount ($tab))

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlTabGetItemRECT

Function Reference

_GUICtrlTabGetItemRECT

Retrieves the bounding rectangle for a tab in a tab control.

#Include <GuiTab.au3>
_GUICtrlTabGetItemRECT($h_tabcontrol, $i_item)

Parameters

$h_tabcontrol | control id/control hWnd
$i_item | Zero-based index of a tab control item.

Return Value

Array containing the RECT, first element ($array[0]) contains the number of elements
If an error occurs, the return value is $TC_ERR.

Remarks

None.

Related

None.

Example

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab0OK, $tab0input, $tab1, $tab1combo, $tab1OK, $tab2, $tab2OK, $tab3, $tab4
Dim $msg, $button, $label_rect, $s_rect

GUICreate("Tab Get Item RECT", 400, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100, BitOR($TCS_FLATBUTTONS, $TCS_MULTILINE), $TCS_EX_FLATSEPARATORS)

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 60, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 60, 70, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 60, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 60, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 60, 50)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab3 = GUICtrlCreateTabItem("tab3")
GUICtrlCreateTabItem("") ; end tabitem definition

$tab4 = GUICtrlCreateTabItem("tab4")
GUICtrlCreateTabItem("") ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)
$button = GUICtrlCreateButton("Get RECT", 200, 130, 90, 30)

$s_rect = "Left:" & @LF & "Top:" & @LF & "Right:" & @LF & "Bottom:"
$label_rect = GUICtrlCreateLabel($s_rect, 250, 20, 100, 65, $SS_SUNKEN)

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
Local $rect_array = _GUICtrlTabGetItemRECT ($tab, 0)
If (IsArray($rect_array)) Then
$s_rect = "Left:" & $rect_array[1] & @LF & "Top:" & $rect_array[2] & @LF & "Right:" & $rect_array[3] & @LF & "Bottom:" & $rect_array[4]
GUICtrlSetData($label_rect, $s_rect)
EndIf
EndSelect
WEnd


Function _GUICtrlTabGetRowCount

Function Reference

_GUICtrlTabGetRowCount

Retrieves the current number of rows of tabs in a tab control.

#Include <GuiTab.au3>
_GUICtrlTabGetRowCount($h_tabcontrol)

Parameters

$h_tabcontrol control id/control hWnd

Return Value

Returns the number of rows of tabs.

Remarks

Only tab controls that have the $TCS_MULTILINE style can have multiple rows of tabs.

Related

_GUICtrlTabGetItemCount

Example

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab0OK, $tab0input, $tab1, $tab1combo, $tab1OK, $tab2, $tab2OK, $tab3, $tab4
Dim $msg, $Status

GUICreate("Tab Get Row Count", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100, $TCS_MULTILINE)

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 60, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 60, 70, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 60, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 60, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 60, 50)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab3 = GUICtrlCreateTabItem("tab3")
GUICtrlCreateTabItem("") ; end tabitem definition

$tab4 = GUICtrlCreateTabItem("tab4")
GUICtrlCreateTabItem("") ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)

$Status = GUICtrlCreateLabel("", 0, 180, 300, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
GUICtrlSetData($Status, "Row Count: " & _GUICtrlTabGetRowCount ($tab))

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlTabGetUnicodeFormat

Function Reference

_GUICtrlTabGetUnicodeFormat

Retrieves the Unicode character format flag for the control.

#Include <GuiTab.au3>
_GUICtrlTabGetUnicodeFormat($h_tabcontrol)

Parameters

$h_tabcontrol control id/control hWnd

Return Value

Returns the Unicode format flag for the control.
If this value is nonzero, the control is using Unicode characters.
If this value is zero, the control is using ANSI characters.

Remarks

None.

Related

_GUICtrlTabSetUnicodeFormat

Example

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab0OK, $tab0input, $tab1, $tab1combo, $tab1OK, $tab2, $tab2OK, $tab3, $tab4
Dim $msg, $Status

GUICreate("Tab Get Unicode Format", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100, $TCS_MULTILINE)

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 60, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 60, 70, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 60, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 60, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 60, 50)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab3 = GUICtrlCreateTabItem("tab3")
GUICtrlCreateTabItem("") ; end tabitem definition

$tab4 = GUICtrlCreateTabItem("tab4")
GUICtrlCreateTabItem("") ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)

$Status = GUICtrlCreateLabel("", 0, 180, 300, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
If (_GUICtrlTabGetUnicodeFormat ($tab)) Then
GUICtrlSetData($Status, "Unicode Format")
Else
GUICtrlSetData($Status, "ANSI Characters")
EndIf

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd


Function _GUICtrlTabHighlightItem

Function Reference

_GUICtrlTabHighlightItem

Sets the highlight state of a tab item.

#Include <GuiTab.au3>
_GUICtrlTabHighlightItem($h_tabcontrol, $i_item, $i_bool)

Parameters

$h_tabcontrol | control id/control hWnd
$i_item | Zero-based index of a tab control item.
$i_bool | Value specifying the highlight state to be set. If this value is TRUE, the tab is highlighted If FALSE, the tab is set to its default state.

Return Value

Returns nonzero if successful, or zero otherwise.

Remarks

None.

Related

_GUICtrlTabSetCurSel

Example

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab0OK, $tab0input, $tab1, $tab1combo, $tab1OK, $tab2, $tab2OK, $tab3, $tab4
Dim $msg, $button, $bool

GUICreate("Tab Highlight Item", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100, $TCS_MULTILINE)

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 60, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 60, 70, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 60, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 60, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 60, 50)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab3 = GUICtrlCreateTabItem("tab3")
GUICtrlCreateTabItem("") ; end tabitem definition

$tab4 = GUICtrlCreateTabItem("tab4")
GUICtrlCreateTabItem("") ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)
$button = GUICtrlCreateButton("Highlight", 200, 130, 90, 30)

GUISetState()

$bool = 0
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$bool = Not $bool
_GUICtrlTabHighlightItem ($tab, 2, $bool)
EndSelect
WEnd


Function _GUICtrlTabSetCurFocus

Function Reference

_GUICtrlTabSetCurFocus

Sets the focus to a specified tab in a tab control.

#Include <GuiTab.au3>
_GUICtrlTabSetCurFocus($h_tabcontrol, $i_item)

Parameters

$h_tabcontrol | control id/control hWnd
$i_item | Zero-based index of a tab control item.

Return Value

None.

Remarks

If the tab control has the $TCS_BUTTONS style (button mode),
the tab with the focus may be different from the selected tab.

For example, when a tab is selected, the user can press the arrow
keys to set the focus to a different tab without changing the selected tab.

In button mode, $TCM_SETCURFOCUS sets the input focus to the button associated
with the specified tab, but it does not change the selected tab.

If the tab control does not have the $TCS_BUTTONS style, changing the focus
also changes the selected tab.

Related

_GUICtrlTabGetCurFocus

Example

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab0OK, $tab0input, $tab1, $tab1combo, $tab1OK, $tab2, $tab2OK, $tab3, $tab4
Dim $msg, $button, $item = 0

GUICreate("Tab Set Current Focus", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100, $TCS_MULTILINE)

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 60, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 60, 70, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 60, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 60, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 60, 50)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab3 = GUICtrlCreateTabItem("tab3")
GUICtrlCreateTabItem("") ; end tabitem definition

$tab4 = GUICtrlCreateTabItem("tab4")
GUICtrlCreateTabItem("") ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)
$button = GUICtrlCreateButton("Set", 200, 130, 90, 30)

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
_GUICtrlTabSetCurFocus ($tab, $item)
$item = Not $item
EndSelect
WEnd


Function _GUICtrlTabSetCurSel

Function Reference

_GUICtrlTabSetCurSel

Selects a tab in a tab control.

#Include <GuiTab.au3>
_GUICtrlTabSetCurSel($h_tabcontrol, $i_item)

Parameters

$h_tabcontrol | control id/control hWnd
$i_item | Zero-based index of a tab control item.

Return Value

Returns the index of the previously selected tab if successful, or $TC_ERR otherwise.

Remarks

A tab control does not send a $TCN_SELCHANGING or $TCN_SELCHANGE
notification message when a tab is selected using this message.

Related

_GUICtrlTabSetCurFocus, _GUICtrlTabGetCurSel

Example

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab0OK, $tab0input, $tab1, $tab1combo, $tab1OK, $tab2, $tab2OK, $tab3, $tab4
Dim $msg, $Status, $current, $button, $item = 0

GUICreate("Tab Set Current Selection", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100, $TCS_MULTILINE)

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 60, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 60, 70, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 60, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 60, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 60, 50)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab3 = GUICtrlCreateTabItem("tab3")
GUICtrlCreateTabItem("") ; end tabitem definition

$tab4 = GUICtrlCreateTabItem("tab4")
GUICtrlCreateTabItem("") ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)
$button = GUICtrlCreateButton("Set", 200, 130, 90, 30)

$Status = GUICtrlCreateLabel("", 0, 180, 300, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
_GUICtrlTabSetCurSel ($tab, $item)
$item = Not $item
EndSelect
WEnd


Function _GUICtrlTabSetMinTabWidth

Function Reference

_GUICtrlTabSetMinTabWidth

Sets the minimum width of items in a tab control.

#Include <GuiTab.au3>
_GUICtrlTabSetMinTabWidth($h_tabcontrol, $i_width)

Parameters

$h_tabcontrol | control id/control hWnd
i_width | Minimum width to be set for a tab control item. If this parameter is set to -1, the control will use the default tab width

Return Value

Returns an INT value that represents the previous minimum tab width.

Remarks

None.

Related

None.

Example

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab0OK, $tab0input, $tab1, $tab1combo, $tab1OK, $tab2, $tab2OK
Dim $msg, $button

GUICreate("Tab Set Min Tab Width", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100)

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 60, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 60, 70, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 60, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 60, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 60, 50)
GUICtrlCreateTabItem("") ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)
$button = GUICtrlCreateButton("Set", 200, 130, 90, 30)

GUISetState()
_GUICtrlTabSetMinTabWidth ($tab, 15)

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
_GUICtrlTabSetMinTabWidth ($tab, 65)
EndSelect
WEnd


Function _GUICtrlTabSetUnicodeFormat

Function Reference

_GUICtrlTabSetUnicodeFormat

Sets the Unicode character format flag for the control.

#Include <GuiTab.au3>
_GUICtrlTabSetUnicodeFormat($h_tabcontrol, $i_bool)

Parameters

$h_tabcontrol | control id/control hWnd
$i_bool | Determines the character set that is used by the control. If this value is nonzero, the control will use Unicode characters. If this value is zero, the control will use ANSI characters.

Return Value

Returns the previous Unicode format flag for the control.

Remarks

None.

Related

_GUICtrlTabGetUnicodeFormat

Example

#include <GUIConstants.au3>
#include <GuiTab.au3>

opt('MustDeclareVars', 1)

Dim $tab, $tab0, $tab0OK, $tab0input, $tab1, $tab1combo, $tab1OK, $tab2, $tab2OK
Dim $msg, $Status, $format = 0, $button, $ret

GUICreate("Tab Set Unicode Format", 300, 200) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100)

$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 60, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 60, 70, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 60, 60, 40)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 60, 50, 20)
GUICtrlCreateTabItem("") ; end tabitem definition

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 60, 50)
GUICtrlCreateTabItem("") ; end tabitem definition

GUICtrlCreateLabel("label3", 20, 130, 50, 20)
$button = GUICtrlCreateButton("Set", 200, 130, 90, 30)

$Status = GUICtrlCreateLabel("", 0, 180, 300, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
$ret = _GUICtrlTabSetUnicodeFormat ($tab, $format)
If ($ret) Then
GUICtrlSetData($Status, "Now ANSI Characters, was Unicode Format")
Else
GUICtrlSetData($Status, "Now Unicode Format, was ANSI Characters")
EndIf
$format = Not $format
EndSelect
WEnd


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: GuiTreeView Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_GUICtrlTreeViewDeleteAllItems | Removes all items from a treeview control.
_GUICtrlTreeViewDeleteItem | Removes an item and all its children from a treeview control.
_GUICtrlTreeViewExpand | Expands or collapses the list of child items associated with the specified parent item, if any.
_GUICtrlTreeViewGetBkColor | Gets the text back color of a treeview control.
_GUICtrlTreeViewGetCount | Retrieves a count of the items in a treeview control.
_GUICtrlTreeViewGetIndent | Retrieves the amount in pixels, that child items are indented relative to their parent items.
_GUICtrlTreeViewGetLineColor | Gets the line color of a treeview control.
_GUICtrlTreeViewGetParentHandle | Gets the parent handle of item selected (default) or any specified item in treeview control.
_GUICtrlTreeViewGetParentID | Gets the parent control ID of item selected (default) or any specified item in treeview control.
_GUICtrlTreeViewGetState | Returns the state of the specified treeview item.
_GUICtrlTreeViewGetText | Returns the test of the specified treeview item.
_GUICtrlTreeViewGetTextColor | Gets the text color of a treeview control.
_GUICtrlTreeViewGetTree | Get all items text beginning by the current selected item from the treeview control.
_GUICtrlTreeViewInsertItem | Insert a new item into a treeview control.
_GUICtrlTreeViewSetBkColor | Sets the back color of a treeview control.
_GUICtrlTreeViewSetIcon | Set an icon of the specified treeview item.
_GUICtrlTreeViewSetIndent | Sets the width of indentation for a treeview control and redraws the control to reflect the new width.
_GUICtrlTreeViewSetLineColor | Sets the line color of a treeview control
_GUICtrlTreeViewSetState | Set the state of the specified treeview item.
_GUICtrlTreeViewSetText | Set a new text to the specified treeview item.
_GUICtrlTreeViewSetTextColor | Sets the text color of a treeview control.
_GUICtrlTreeViewSort | Sorts the items of a treeview control.


Function _GUICtrlTreeViewDeleteAllItems

Function Reference

_GUICtrlTreeViewDeleteAllItems

Removes all items from a treeview control.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewDeleteAllItems($i_treeview)

Parameters

$i_treeview controlID

Return Value

Returns TRUE if successful, or FALSE otherwise.

Remarks

None.

Related

_GUICtrlTreeViewDeleteItem

Example

#include <GuiTreeView.au3>

opt("MustDeclareVars", 1)
opt("GUIDataSeparatorChar", "\")
Dim $h_GUI, $treeview, $nItem1, $nItem2, $nSubItem1, $nSubItem2, $nSubItem3, $nSubItem4, $Btn_DeleteAll, $Msg

$h_GUI = GUICreate("TreeView Delete All Items", 392, 254)

$treeview = GUICtrlCreateTreeView(10, 10, 150, 150)
$nItem2 = GUICtrlCreateTreeViewItem("Item2", $treeview)
$nItem1 = GUICtrlCreateTreeViewItem("Item1", $treeview)
$nSubItem2 = GUICtrlCreateTreeViewItem("SubItem2", $nItem1)
$nSubItem1 = GUICtrlCreateTreeViewItem("SubItem1", $nItem1)
$nSubItem4 = GUICtrlCreateTreeViewItem("SubItem4", $nSubItem1)
$nSubItem3 = GUICtrlCreateTreeViewItem("SubItem3", $nSubItem1)

$Btn_DeleteAll = GUICtrlCreateButton("Delete All", 70, 170, 70, 20)

GUISetState()

While 1
$Msg = GUIGetMsg()
Select
Case $Msg = $GUI_EVENT_CLOSE
ExitLoop
Case $Msg = $Btn_DeleteAll
_GUICtrlTreeViewDeleteAllItems ($treeview)
EndSelect
WEnd

Exit


Function _GUICtrlTreeViewDeleteItem

Function Reference

_GUICtrlTreeViewDeleteItem

Removes an item and all its children from a treeview control.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewDeleteItem($h_wnd, $i_treeview[, $h_itemID = 0])

Parameters

$h_wnd | GUI handle as returned by GUICreate....
$i_treeview | controlID
$h_itemID | Optional: item ID/handle

Return Value

Returns TRUE if successful, or FALSE otherwise.

Remarks

None.

Related

_GUICtrlTreeViewDeleteAllItems

Example

#include <GuiTreeView.au3>

opt("MustDeclareVars", 1)
opt("GUIDataSeparatorChar", "\")
Dim $h_GUI, $treeview, $nItem1, $nItem2, $nSubItem1, $nSubItem2, $nSubItem3, $nSubItem4
Dim $Btn_Delete, $Btn_DeleteItem, $Msg

$h_GUI = GUICreate("TreeView Delete Item", 392, 254)

$treeview = GUICtrlCreateTreeView(10, 10, 150, 150)
$nItem2 = GUICtrlCreateTreeViewItem("Item2", $treeview)
$nItem1 = GUICtrlCreateTreeViewItem("Item1", $treeview)
$nSubItem2 = GUICtrlCreateTreeViewItem("SubItem2", $nItem1)
$nSubItem1 = GUICtrlCreateTreeViewItem("SubItem1", $nItem1)
$nSubItem3 = GUICtrlCreateTreeViewItem("SubItem3", $nSubItem1)
$nSubItem4 = GUICtrlCreateTreeViewItem("SubItem4", $nSubItem3)

$Btn_Delete = GUICtrlCreateButton("Delete Selected", 70, 170, 90, 20)
$Btn_DeleteItem = GUICtrlCreateButton("Delete SubItem4", 70, 200, 90, 20)

GUISetState()

While 1
$Msg = GUIGetMsg()
Select
Case $Msg = $GUI_EVENT_CLOSE
ExitLoop
Case $Msg = $Btn_Delete
_GUICtrlTreeViewDeleteItem ($h_GUI, $treeview)
Case $Msg = $Btn_DeleteItem
_GUICtrlTreeViewDeleteItem ($h_GUI, $treeview, $nSubItem4)
EndSelect
WEnd

Exit


Function _GUICtrlTreeViewExpand

Function Reference

_GUICtrlTreeViewExpand

Expands or collapses the list of child items associated with the specified parent item, if any.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewExpand($i_treeview[, $i_expand = 1[, $h_itemID = 0]])

Parameters

$i_treeview | controlID
$i_expand | Optional: expand items (default 1)
$h_itemID | Optional: item ID/handle (default 0)

Return Value

None.

Remarks

None.

Related

None.

Example

#include <GuiTreeView.au3>

opt("MustDeclareVars", 1)
opt("GUIDataSeparatorChar", "\")
Dim $h_GUI, $treeview, $nItem1, $nItem2, $nItem3
Dim $nSubItem1, $nSubItem2, $nSubItem3, $nSubItem4, $nSubItem5, $nSubItem6, $nSubItem7
Dim $Btn_Expand, $Btn_ExpandItem, $Msg, $Btn_Collapse, $Btn_CollapseItem

$h_GUI = GUICreate("TreeView Expand", 392, 254)

$treeview = GUICtrlCreateTreeView(10, 10, 150, 150)
$nItem2 = GUICtrlCreateTreeViewItem("Item2", $treeview)
$nItem1 = GUICtrlCreateTreeViewItem("Item1", $treeview)
$nItem3 = GUICtrlCreateTreeViewItem("Item3", $treeview)
$nSubItem2 = GUICtrlCreateTreeViewItem("SubItem2", $nItem1)
$nSubItem1 = GUICtrlCreateTreeViewItem("SubItem1", $nItem1)
$nSubItem4 = GUICtrlCreateTreeViewItem("SubItem4", $nSubItem1)
$nSubItem5 = GUICtrlCreateTreeViewItem("SubItem5", $nSubItem4)
$nSubItem6 = GUICtrlCreateTreeViewItem("SubItem6", $nSubItem5)
$nSubItem3 = GUICtrlCreateTreeViewItem("SubItem3", $nSubItem1)
$nSubItem7 = GUICtrlCreateTreeViewItem("SubItem7", $nItem3)

$Btn_Expand = GUICtrlCreateButton("Expand All", 70, 170, 90, 20)
$Btn_Collapse = GUICtrlCreateButton("Collapse All", 200, 170, 90, 20)
$Btn_ExpandItem = GUICtrlCreateButton("Expand Item1", 70, 200, 90, 20)
$Btn_CollapseItem = GUICtrlCreateButton("Collapse Item1", 200, 200, 90, 20)

GUISetState()

While 1
$Msg = GUIGetMsg()
Select
Case $Msg = $GUI_EVENT_CLOSE
ExitLoop
Case $Msg = $Btn_Expand
_GUICtrlTreeViewExpand($treeview)
Case $Msg = $Btn_ExpandItem
_GUICtrlTreeViewExpand($treeview, 1, $nItem1)
Case $Msg = $Btn_Collapse
_GUICtrlTreeViewExpand($treeview, 0)
Case $Msg = $Btn_CollapseItem
_GUICtrlTreeViewExpand($treeview, 0, $nItem1)
EndSelect
WEnd

Exit


Function _GUICtrlTreeViewGetBkColor

Function Reference

_GUICtrlTreeViewGetBkColor

Gets the text back color of a treeview control.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewGetBkColor($i_treeview)

Parameters

$i_treeview controlID

Return Value

Returns Hex RGB back color of the control.

Remarks

None.

Related

_GUICtrlTreeViewGetLineColor, _GUICtrlTreeViewGetTextColor, _GUICtrlTreeViewSetBkColor, _GUICtrlTreeViewSetLineColor, _GUICtrlTreeViewSetTextColor

Example

#include <WindowsConstants.au3>
#include <GuiTreeView.au3>
#include <GuiStatusBar.au3>

opt("MustDeclareVars", 1)

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C
Global Const $White = 0xFFFFFF

Dim $myGui, $treeview, $generalitem, $displayitem, $aboutitem, $compitem, $useritem, $resitem, $otheritem
Dim $Status, $startlabel, $aboutlabel, $compinfo, $cancelbutton, $msg

$myGui = GUICreate("TreeView Get Back Color", 392, 254)

$treeview = GUICtrlCreateTreeView(6, 6, 100, 150, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$generalitem = GUICtrlCreateTreeViewItem("General", $treeview)
$displayitem = GUICtrlCreateTreeViewItem("Display", $treeview)
$aboutitem = GUICtrlCreateTreeViewItem("About", $generalitem)
$compitem = GUICtrlCreateTreeViewItem("Computer", $generalitem)
$useritem = GUICtrlCreateTreeViewItem("User", $generalitem)
$resitem = GUICtrlCreateTreeViewItem("Resolution", $displayitem)
$otheritem = GUICtrlCreateTreeViewItem("Other", $displayitem)
$Status = _GuiCtrlStatusBarCreate($myGui, -1, "")
_GuiCtrlStatusBarSetSimple($Status)

$startlabel = GUICtrlCreateLabel("TreeView Demo", 190, 90, 100, 20)
$aboutlabel = GUICtrlCreateLabel("This little scripts demonstates the using of a treeview-control.", 190, 70, 100, 60)
GUICtrlSetState(-1, $GUI_HIDE)
$compinfo = GUICtrlCreateLabel("Name:" & @TAB & @ComputerName & @LF & "OS:" & @TAB & @OSVersion & @LF & "SP:" & @TAB & @OSServicePack, 120, 30, 200, 80)
GUICtrlSetState(-1, $GUI_HIDE)

$cancelbutton = GUICtrlCreateButton("Cancel", 180, 185, 70, 20)

_GUICtrlTreeViewSetBkColor ($treeview, $Turquoise)
_GUICtrlTreeViewSetTextColor ($treeview, $Crimson)
_GUICtrlTreeViewSetLineColor ($treeview, $White)

GUISetState()
_GuiCtrlStatusBarSetText($Status,"Hex RGB Treeview Back Color: " & _GUICtrlTreeViewGetBkColor ($treeview),255)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE
ExitLoop

Case $msg = $generalitem
GUIChangeItems($aboutlabel, $compinfo, $startlabel, $startlabel)

Case $msg = $aboutitem
GUICtrlSetState($compinfo, $GUI_HIDE)
GUIChangeItems($startlabel, $startlabel, $aboutlabel, $aboutlabel)

Case $msg = $compitem
GUIChangeItems($startlabel, $aboutlabel, $compinfo, $compinfo)

EndSelect
WEnd

GUIDelete()
Exit

Func GUIChangeItems($hidestart, $hideend, $showstart, $showend)
Local $idx

For $idx = $hidestart To $hideend
GUICtrlSetState($idx, $GUI_HIDE)
Next
For $idx = $showstart To $showend
GUICtrlSetState($idx, $GUI_SHOW)
Next
EndFunc ;==>GUIChangeItems


Function _GUICtrlTreeViewGetCount

Function Reference

_GUICtrlTreeViewGetCount

Retrieves a count of the items in a treeview control.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewGetCount($i_treeview)

Parameters

$i_treeview controlID

Return Value

Returns the count of items.

Remarks

None.

Related

None.

Example

#include <WindowsConstants.au3>
#include <GuiTreeView.au3>
#include <GuiStatusBar.au3>

opt("MustDeclareVars", 1)

Dim $myGui, $treeview, $generalitem, $displayitem, $aboutitem
Dim $compitem, $useritem, $resitem, $otheritem, $Status, $startlabel, $aboutlabel
Dim $compinfo, $msg, $cancelbutton

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C
Global Const $White = 0xFFFFFF

$myGui = GUICreate("TreeView Get Count", 392, 254)

$treeview = GUICtrlCreateTreeView(6, 6, 100, 150, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$generalitem = GUICtrlCreateTreeViewItem("General", $treeview)
$displayitem = GUICtrlCreateTreeViewItem("Display", $treeview)
$aboutitem = GUICtrlCreateTreeViewItem("About", $generalitem)
$compitem = GUICtrlCreateTreeViewItem("Computer", $generalitem)
$useritem = GUICtrlCreateTreeViewItem("User", $generalitem)
$resitem = GUICtrlCreateTreeViewItem("Resolution", $displayitem)
$otheritem = GUICtrlCreateTreeViewItem("Other", $displayitem)
$Status = _GuiCtrlStatusBarCreate($myGui, -1, "")
_GuiCtrlStatusBarSetSimple($Status)

$startlabel = GUICtrlCreateLabel("TreeView Demo", 190, 90, 100, 20)
$aboutlabel = GUICtrlCreateLabel("This little scripts demonstates the using of a treeview-control.", 190, 70, 100, 60)
GUICtrlSetState(-1, $GUI_HIDE)
$compinfo = GUICtrlCreateLabel("Name:" & @TAB & @ComputerName & @LF & "OS:" & @TAB & @OSVersion & @LF & "SP:" & @TAB & @OSServicePack, 120, 30, 200, 80)
GUICtrlSetState(-1, $GUI_HIDE)

$cancelbutton = GUICtrlCreateButton("Cancel", 180, 185, 70, 20)

_GUICtrlTreeViewSetBkColor ($treeview, $Turquoise)
_GUICtrlTreeViewSetTextColor ($treeview, $Crimson)
_GUICtrlTreeViewSetLineColor ($treeview, $White)

GUISetState()
_GuiCtrlStatusBarSetText($Status,"Number Of Items: " & _GUICtrlTreeViewGetCount ($treeview),255)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE
ExitLoop

Case $msg = $generalitem
GUIChangeItems($aboutlabel, $compinfo, $startlabel, $startlabel)

Case $msg = $aboutitem
GUICtrlSetState($compinfo, $GUI_HIDE)
GUIChangeItems($startlabel, $startlabel, $aboutlabel, $aboutlabel)

Case $msg = $compitem
GUIChangeItems($startlabel, $aboutlabel, $compinfo, $compinfo)

EndSelect
WEnd

GUIDelete()
Exit

Func GUIChangeItems($hidestart, $hideend, $showstart, $showend)
Local $idx

For $idx = $hidestart To $hideend
GUICtrlSetState($idx, $GUI_HIDE)
Next
For $idx = $showstart To $showend
GUICtrlSetState($idx, $GUI_SHOW)
Next
EndFunc ;==>GUIChangeItems


Function _GUICtrlTreeViewGetIndent

Function Reference

_GUICtrlTreeViewGetIndent

Retrieves the amount in pixels, that child items are indented relative to their parent items.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewGetIndent($i_treeview)

Parameters

$i_treeview controlID

Return Value

Returns the amount of indentation.

Remarks

None.

Related

_GUICtrlTreeViewSetIndent

Example

#include <WindowsConstants.au3>
#include <GuiTreeView.au3>
#include <GuiStatusBar.au3>

opt("MustDeclareVars", 1)

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C
Global Const $White = 0xFFFFFF

Dim $myGui, $treeview, $generalitem, $displayitem, $aboutitem
Dim $compitem, $useritem, $resitem, $otheritem, $Status, $startlabel, $aboutlabel
Dim $compinfo, $msg, $cancelbutton

$myGui = GUICreate("TreeView Get Indent", 392, 254)

$treeview = GUICtrlCreateTreeView(6, 6, 100, 150, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$generalitem = GUICtrlCreateTreeViewItem("General", $treeview)
$displayitem = GUICtrlCreateTreeViewItem("Display", $treeview)
$aboutitem = GUICtrlCreateTreeViewItem("About", $generalitem)
$compitem = GUICtrlCreateTreeViewItem("Computer", $generalitem)
$useritem = GUICtrlCreateTreeViewItem("User", $generalitem)
$resitem = GUICtrlCreateTreeViewItem("Resolution", $displayitem)
$otheritem = GUICtrlCreateTreeViewItem("Other", $displayitem)
$Status = _GuiCtrlStatusBarCreate($myGui, -1, "")
_GuiCtrlStatusBarSetSimple($Status)

$startlabel = GUICtrlCreateLabel("TreeView Demo", 190, 90, 100, 20)
$aboutlabel = GUICtrlCreateLabel("This little scripts demonstates the using of a treeview-control.", 190, 70, 100, 60)
GUICtrlSetState(-1, $GUI_HIDE)
$compinfo = GUICtrlCreateLabel("Name:" & @TAB & @ComputerName & @LF & "OS:" & @TAB & @OSVersion & @LF & "SP:" & @TAB & @OSServicePack, 120, 30, 200, 80)
GUICtrlSetState(-1, $GUI_HIDE)

$cancelbutton = GUICtrlCreateButton("Cancel", 180, 185, 70, 20)

_GUICtrlTreeViewSetBkColor ($treeview, $Turquoise)
_GUICtrlTreeViewSetTextColor ($treeview, $Crimson)
_GUICtrlTreeViewSetLineColor ($treeview, $White)

GUISetState()
_GuiCtrlStatusBarSetText($Status,"Indent: " & _GUICtrlTreeViewGetIndent ($treeview) & " in pixels",255)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE
ExitLoop

Case $msg = $generalitem
GUIChangeItems($aboutlabel, $compinfo, $startlabel, $startlabel)

Case $msg = $aboutitem
GUICtrlSetState($compinfo, $GUI_HIDE)
GUIChangeItems($startlabel, $startlabel, $aboutlabel, $aboutlabel)

Case $msg = $compitem
GUIChangeItems($startlabel, $aboutlabel, $compinfo, $compinfo)

EndSelect
WEnd

GUIDelete()
Exit

Func GUIChangeItems($hidestart, $hideend, $showstart, $showend)
Local $idx

For $idx = $hidestart To $hideend
GUICtrlSetState($idx, $GUI_HIDE)
Next
For $idx = $showstart To $showend
GUICtrlSetState($idx, $GUI_SHOW)
Next
EndFunc ;==>GUIChangeItems


Function _GUICtrlTreeViewGetLineColor

Function Reference

_GUICtrlTreeViewGetLineColor

Gets the line color of a treeview control.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewGetLineColor($i_treeview)

Parameters

$i_treeview controlID

Return Value

Returns Hex RGB line color of the control.

Remarks

None.

Related

_GUICtrlTreeViewGetBkColor, _GUICtrlTreeViewGetTextColor, _GUICtrlTreeViewSetBkColor, _GUICtrlTreeViewSetLineColor, _GUICtrlTreeViewSetTextColor

Example

#include <WindowsConstants.au3>
#include <GuiTreeView.au3>
#include <GuiStatusBar.au3>

opt("MustDeclareVars", 1)

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C
Global Const $White = 0xFFFFFF

Dim $myGui, $treeview, $generalitem, $displayitem, $aboutitem
Dim $compitem, $useritem, $resitem, $otheritem, $Status, $startlabel, $aboutlabel
Dim $compinfo, $msg, $cancelbutton

$myGui = GUICreate("TreeView Get Line Color", 392, 254)

$treeview = GUICtrlCreateTreeView(6, 6, 100, 150, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$generalitem = GUICtrlCreateTreeViewItem("General", $treeview)
$displayitem = GUICtrlCreateTreeViewItem("Display", $treeview)
$aboutitem = GUICtrlCreateTreeViewItem("About", $generalitem)
$compitem = GUICtrlCreateTreeViewItem("Computer", $generalitem)
$useritem = GUICtrlCreateTreeViewItem("User", $generalitem)
$resitem = GUICtrlCreateTreeViewItem("Resolution", $displayitem)
$otheritem = GUICtrlCreateTreeViewItem("Other", $displayitem)
$Status = _GuiCtrlStatusBarCreate($myGui, -1, "")
_GuiCtrlStatusBarSetSimple($Status)

$startlabel = GUICtrlCreateLabel("TreeView Demo", 190, 90, 100, 20)
$aboutlabel = GUICtrlCreateLabel("This little scripts demonstates the using of a treeview-control.", 190, 70, 100, 60)
GUICtrlSetState(-1, $GUI_HIDE)
$compinfo = GUICtrlCreateLabel("Name:" & @TAB & @ComputerName & @LF & "OS:" & @TAB & @OSVersion & @LF & "SP:" & @TAB & @OSServicePack, 120, 30, 200, 80)
GUICtrlSetState(-1, $GUI_HIDE)

$cancelbutton = GUICtrlCreateButton("Cancel", 180, 185, 70, 20)

_GUICtrlTreeViewSetBkColor ($treeview, $Turquoise)
_GUICtrlTreeViewSetTextColor ($treeview, $Crimson)
_GUICtrlTreeViewSetLineColor ($treeview, $White)

GUISetState()
_GuiCtrlStatusBarSetText($Status,"Hex RGB Treeview Line Color: " & _GUICtrlTreeViewGetLineColor ($treeview),255)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE
ExitLoop

Case $msg = $generalitem
GUIChangeItems($aboutlabel, $compinfo, $startlabel, $startlabel)

Case $msg = $aboutitem
GUICtrlSetState($compinfo, $GUI_HIDE)
GUIChangeItems($startlabel, $startlabel, $aboutlabel, $aboutlabel)

Case $msg = $compitem
GUIChangeItems($startlabel, $aboutlabel, $compinfo, $compinfo)

EndSelect
WEnd

GUIDelete()
Exit

Func GUIChangeItems($hidestart, $hideend, $showstart, $showend)
Local $idx

For $idx = $hidestart To $hideend
GUICtrlSetState($idx, $GUI_HIDE)
Next
For $idx = $showstart To $showend
GUICtrlSetState($idx, $GUI_SHOW)
Next
EndFunc ;==>GUIChangeItems


Function _GUICtrlTreeViewGetParentHandle

Function Reference

_GUICtrlTreeViewGetParentHandle

Gets the parent handle of item selected (default) or any specified item in treeview control.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewGetParentHandle($i_treeview[, $h_itemID = 0])

Parameters

$i_treeview | controlID
$h_itemID | Optional: specified item ID/handle to get the parent of (default 0)

Return Value

Returns the parent handle.

Remarks

None.

Related

None.

Example

#include <GuiTreeView.au3>
#include <GuiStatusBar.au3>

opt ("MustDeclareVars", 1)

Dim $tree, $item1, $subitem1, $subitem2, $item2, $subitem3, $subitem4, $button, $msg, $Status, $gui

$gui = GUICreate("Test", 392, 254)
$tree = GUICtrlCreateTreeView(10, 10, 200, 200)

$item1 = GUICtrlCreateTreeViewItem("Mainitem1", $tree)
$subitem1 = GUICtrlCreateTreeViewItem("Subitem11", $item1)
$subitem2 = GUICtrlCreateTreeViewItem("Subitem12", $item1)
$item2 = GUICtrlCreateTreeViewItem("Mainitem2", $tree)
$subitem3 = GUICtrlCreateTreeViewItem("Subitem21", $item2)
$subitem4 = GUICtrlCreateTreeViewItem("Subitem22", $item2)

$button = GUICtrlCreateButton("Check", 220, 100, 70, 20)
$Status = _GuiCtrlStatusBarCreate($gui, -1, "")
_GuiCtrlStatusBarSetSimple($Status)

GUISetState()

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
_GuiCtrlStatusBarSetText($Status, "Parent Handle: " & _GUICtrlTreeViewGetParentHandle ($tree),255)
EndSelect
WEnd

Exit


Function _GUICtrlTreeViewGetParentID

Function Reference

_GUICtrlTreeViewGetParentID

Gets the parent control ID of item selected (default) or any specified item in treeview control.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewGetParentID($i_treeview[, $h_itemID = 0])

Parameters

$i_treeview | controlID
$h_itemID | Optional: specified item ID/handle to get the parent of (default 0)

Return Value

Returns the parent control ID.

Remarks

None.

Related

None.

Example

#include <GuiTreeView.au3>
#include <GuiStatusBar.au3>
opt("MustDeclareVars", 1)

Dim $tree, $item1, $subitem1, $subitem2, $item2, $subitem3, $subitem4, $button, $msg, $Status, $gui
$gui = GUICreate("GuiTreeView Get Parent ID", 392, 254)
$tree = GUICtrlCreateTreeView(10, 10, 200, 200)
$item1 = GUICtrlCreateTreeViewItem("Mainitem1", $tree)
$subitem1 = GUICtrlCreateTreeViewItem("Subitem11", $item1)
$subitem2 = GUICtrlCreateTreeViewItem("Subitem12", $item1)
$item2 = GUICtrlCreateTreeViewItem("Mainitem2", $tree)
$subitem3 = GUICtrlCreateTreeViewItem("Subitem21", $item2)
$subitem4 = GUICtrlCreateTreeViewItem("Subitem22", $item2)
$button = GUICtrlCreateButton("Check", 220, 100, 70, 20)
$Status = _GuiCtrlStatusBarCreate($gui, -1, "")
_GuiCtrlStatusBarSetSimple($Status)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button
_GuiCtrlStatusBarSetText($Status, "Parent Text: " & GUICtrlRead(_GUICtrlTreeViewGetParentID ($tree), 1),255)
EndSelect
WEnd
Exit


Function _GUICtrlTreeViewGetState

Function Reference

_GUICtrlTreeViewGetState

Returns the state of the specified treeview item.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewGetState($i_treeview, $h_item)

Parameters

$i_treeview | controlID
$h_item | item ID/handle to get the state of

Return Value

Success: Returns the state of the item (See Remarks).
Failure: Returns 0.

Remarks

State table
State | Value
$TVIS_SELECTED | 2
$TVIS_CUT | 4
$TVIS_DROPHILITED | 8
$TVIS_BOLD | 16
$TVIS_EXPANDED | 32
$TVIS_EXPANDEDONCE | 64
$TVIS_EXPANDPARTIAL | 128

Related

_GUICtrlTreeViewSetState

Example

#include <WindowsConstants.au3>
#include <GuiTreeView.au3>

Opt("MustDeclareVars", 1)
Opt("GUIDataSeparatorChar", "\")

Dim $h_GUI, $Msg, $treeview
Dim $h_root1, $h_root2, $h_root3, $h_tmp
Dim $n_btn_getstate

$h_GUI = GUICreate("TreeView UDF Sample", 220, 250)

$treeview = GUICtrlCreateTreeView(10, 10, 200, 200, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetImage(-1, "shell32.dll", 3, 4)
GUICtrlSetImage(-1, "shell32.dll", 4, 2)

$h_root1 = _GUICtrlTreeViewInsertItem($treeview, "RootItem1")
_GUICtrlTreeViewSetIcon($treeview, $h_root1, "shell32.dll", 7)

_GUICtrlTreeViewInsertItem($treeview, "SubItem1", $h_root1)
_GUICtrlTreeViewInsertItem($treeview, "SubItem2", $h_root1)

$h_root2 = _GUICtrlTreeViewInsertItem($treeview, "RootItem2")
_GUICtrlTreeViewSetIcon($treeview, $h_root2, "shell32.dll", 12)

$h_root3 = _GUICtrlTreeViewInsertItem($treeview, "RootItem3")
_GUICtrlTreeViewInsertItem($treeview, "SubItem3", $h_root3)
_GUICtrlTreeViewInsertItem($treeview, "SubItem4", $h_root3)

$n_btn_getstate = GUICtrlCreateButton("Get RootItem2 State", 10, 220, 200, 20)

GUISetState()

While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
ExitLoop

Case $n_btn_getstate
Msgbox(0, "State", _GUICtrlTreeViewGetState($treeview, $h_root2))
EndSwitch
WEnd

Exit


Function _GUICtrlTreeViewGetText

Function Reference

_GUICtrlTreeViewGetText

Returns the test of the specified treeview item.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewGetText($i_treeview, $h_item)

Parameters

$i_treeview | controlID
$h_item | item ID/handle to get the text of

Return Value

Success: Returns the text of the item.
Failure: Returns an empty string.

Remarks

None.

Related

None.

Example

#include <WindowsConstants.au3>
#include <GuiTreeView.au3>
#include <GuiStatusBar.au3>

Opt("MustDeclareVars", 1)

Dim $h_GUI, $Msg, $treeview
Dim $h_root1, $h_root2, $h_root3, $h_item
Dim $n_btn_gettext, $Status

$h_GUI = GUICreate("TreeView UDF Sample", 220, 250)

$treeview = GUICtrlCreateTreeView(10, 10, 200, 180, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetImage(-1, "shell32.dll", 3, 4)
GUICtrlSetImage(-1, "shell32.dll", 4, 2)

$h_root1 = _GUICtrlTreeViewInsertItem($treeview, "RootItem1")
_GUICtrlTreeViewSetIcon($treeview, $h_root1, "shell32.dll", 7)

_GUICtrlTreeViewInsertItem($treeview, "SubItem1", $h_root1)
_GUICtrlTreeViewInsertItem($treeview, "SubItem2", $h_root1)

$h_root2 = _GUICtrlTreeViewInsertItem($treeview, "RootItem2")
_GUICtrlTreeViewSetIcon($treeview, $h_root2, "shell32.dll", 12)

$h_root3 = _GUICtrlTreeViewInsertItem($treeview, "RootItem3")
_GUICtrlTreeViewInsertItem($treeview, "SubItem3", $h_root3)
_GUICtrlTreeViewInsertItem($treeview, "SubItem4", $h_root3)

$n_btn_gettext = GUICtrlCreateButton("Get text", 10, 200, 200, 20)

$Status = _GuiCtrlStatusBarCreate($h_GUI, -1, "")
_GuiCtrlStatusBarSetSimple($Status)

GUISetState()

While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
ExitLoop

Case $n_btn_gettext
$h_item = GUICtrlSendMsg($treeview, $TVM_GETNEXTITEM, $TVGN_CARET, 0)
If $h_item > 0 Then _GuiCtrlStatusBarSetText($Status,"Get Text: " & _GUICtrlTreeViewGetText($treeview, $h_item),255)
EndSwitch
WEnd

Exit


Function _GUICtrlTreeViewGetTextColor

Function Reference

_GUICtrlTreeViewGetTextColor

Gets the text color of a treeview control.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewGetTextColor($i_treeview)

Parameters

$i_treeview controlID

Return Value

Returns Hex RGB text color of the control.

Remarks

None.

Related

_GUICtrlTreeViewGetBkColor, _GUICtrlTreeViewGetLineColor, _GUICtrlTreeViewSetBkColor, _GUICtrlTreeViewSetLineColor, _GUICtrlTreeViewSetTextColor

Example

#include <WindowsConstants.au3>
#include <GuiTreeView.au3>
#include <GuiStatusBar.au3>

opt("MustDeclareVars", 1)

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C
Global Const $White = 0xFFFFFF

Dim $myGui, $treeview, $generalitem, $displayitem, $aboutitem
Dim $compitem, $useritem, $resitem, $otheritem, $Status, $startlabel, $aboutlabel
Dim $compinfo, $msg, $cancelbutton

$myGui = GUICreate("TreeView Get Text Color", 392, 254)

$treeview = GUICtrlCreateTreeView(6, 6, 100, 150, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$generalitem = GUICtrlCreateTreeViewItem("General", $treeview)
$displayitem = GUICtrlCreateTreeViewItem("Display", $treeview)
$aboutitem = GUICtrlCreateTreeViewItem("About", $generalitem)
$compitem = GUICtrlCreateTreeViewItem("Computer", $generalitem)
$useritem = GUICtrlCreateTreeViewItem("User", $generalitem)
$resitem = GUICtrlCreateTreeViewItem("Resolution", $displayitem)
$otheritem = GUICtrlCreateTreeViewItem("Other", $displayitem)
$Status = _GuiCtrlStatusBarCreate($myGui, -1, "")
_GuiCtrlStatusBarSetSimple($Status)

$startlabel = GUICtrlCreateLabel("TreeView Demo", 190, 90, 100, 20)
$aboutlabel = GUICtrlCreateLabel("This little scripts demonstates the using of a treeview-control.", 190, 70, 100, 60)
GUICtrlSetState(-1, $GUI_HIDE)
$compinfo = GUICtrlCreateLabel("Name:" & @TAB & @ComputerName & @LF & "OS:" & @TAB & @OSVersion & @LF & "SP:" & @TAB & @OSServicePack, 120, 30, 200, 80)
GUICtrlSetState(-1, $GUI_HIDE)

$cancelbutton = GUICtrlCreateButton("Cancel", 180, 185, 70, 20)

_GUICtrlTreeViewSetBkColor ($treeview, $Turquoise)
_GUICtrlTreeViewSetTextColor ($treeview, $Crimson)
_GUICtrlTreeViewSetLineColor ($treeview, $White)

GUISetState()
_GuiCtrlStatusBarSetText($Status,"Hex RGB Treeview Text Color: " & _GUICtrlTreeViewGetTextColor ($treeview),255)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE
ExitLoop

Case $msg = $generalitem
GUIChangeItems($aboutlabel, $compinfo, $startlabel, $startlabel)

Case $msg = $aboutitem
GUICtrlSetState($compinfo, $GUI_HIDE)
GUIChangeItems($startlabel, $startlabel, $aboutlabel, $aboutlabel)

Case $msg = $compitem
GUIChangeItems($startlabel, $aboutlabel, $compinfo, $compinfo)

EndSelect
WEnd

GUIDelete()
Exit

Func GUIChangeItems($hidestart, $hideend, $showstart, $showend)
Local $idx

For $idx = $hidestart To $hideend
GUICtrlSetState($idx, $GUI_HIDE)
Next
For $idx = $showstart To $showend
GUICtrlSetState($idx, $GUI_SHOW)
Next
EndFunc ;==>GUIChangeItems


Function _GUICtrlTreeViewGetTree

Function Reference

_GUICtrlTreeViewGetTree

Get all items text beginning by the current selected item from the treeview control.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewGetTree($i_treeview, $s_sep_char)

Parameters

$i_treeview | controlID
$s_sep_char | character used for path seperator

Return Value

Success: Returns the Tree Path of the selected item.
Failure: Returns an empty string (i.e. no item is currently selected).

Remarks

None.

Related

None.

Example

#include <WindowsConstants.au3>
#include <GuiTreeView.au3>
#include <GuiStatusBar.au3>

opt("MustDeclareVars", 1)

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C
Global Const $White = 0xFFFFFF

Dim $hGUI, $treeview, $nItem1, $nItem2, $nItem3
Dim $nSubItem1, $nSubItem2, $nSubItem3, $nSubItem4
Dim $nButton, $Status, $nMsg

$hGUI = GUICreate("TreeView Item Get Tree", 392, 254)

$treeview = GUICtrlCreateTreeView(10, 10, 150, 150)
$nItem2 = GUICtrlCreateTreeViewItem("Item2", $treeview)
$nItem1 = GUICtrlCreateTreeViewItem("Item1", $treeview)
$nSubItem2 = GUICtrlCreateTreeViewItem("SubItem2", $nItem1)
$nSubItem1 = GUICtrlCreateTreeViewItem("SubItem1", $nItem1)
$nSubItem4 = GUICtrlCreateTreeViewItem("SubItem4", $nSubItem1)
$nSubItem3 = GUICtrlCreateTreeViewItem("SubItem3", $nSubItem1)

$nButton = GUICtrlCreateButton("Path?", 70, 170, 70, 20)
$Status = _GuiCtrlStatusBarCreate($hGUI, -1, "")
_GuiCtrlStatusBarSetSimple($Status)

_GUICtrlTreeViewSetBkColor($treeview, $Turquoise)
_GUICtrlTreeViewSetTextColor($treeview, $Crimson)
_GUICtrlTreeViewSetLineColor($treeview, $White)
_GUICtrlTreeViewSetIndent($treeview, 30)

GUISetState()

While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
ExitLoop
Case $nMsg = $nButton
_GuiCtrlStatusBarSetText($Status,"Path: " & _GUICtrlTreeViewGetTree($treeview, "\"),255)
EndSelect
WEnd

Exit


Function _GUICtrlTreeViewInsertItem

Function Reference

_GUICtrlTreeViewInsertItem

Insert a new item into a treeview control.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewInsertItem($i_treeview, $s_itemtext [, $h_item [, $h_item_after]])

Parameters

$i_treeview | controlID
$s_itemtext | item text
$h_item | Optional: parent item handle (default $TVI_ROOT)
$h_item_after | Optional: item handle to insert new item after (default $TVI_LAST)

Return Value

Success: Returns the handle to the new inserted item.
Failure: Returns 0.

Remarks

None.

Related

None.

Example

#include <WindowsConstants.au3>
#include <GuiTreeView.au3>

Opt("MustDeclareVars", 1)

Dim $h_GUI, $Msg, $treeview
Dim $h_root1, $h_root2, $h_root3
Dim $n_btn_insert

$h_GUI = GUICreate("TreeView UDF Sample", 220, 250)

$treeview = GUICtrlCreateTreeView(10, 10, 200, 200, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetImage(-1, "shell32.dll", 3, 4)
GUICtrlSetImage(-1, "shell32.dll", 4, 2)

$h_root1 = _GUICtrlTreeViewInsertItem($treeview, "RootItem1")
_GUICtrlTreeViewInsertItem($treeview, "SubItem1", $h_root1)
_GUICtrlTreeViewInsertItem($treeview, "SubItem2", $h_root1)

$h_root2 = _GUICtrlTreeViewInsertItem($treeview, "RootItem2")

$h_root3 = _GUICtrlTreeViewInsertItem($treeview, "RootItem3")
_GUICtrlTreeViewInsertItem($treeview, "SubItem3", $h_root3)
_GUICtrlTreeViewInsertItem($treeview, "SubItem4", $h_root3)

$n_btn_insert = GUICtrlCreateButton("Insert Items", 10, 220, 200, 20)

GUISetState()

While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
ExitLoop

Case $n_btn_insert
GUICtrlSetCursor($treeview, 1)
For $i = 3 To 500
_GUICtrlTreeViewInsertItem($treeview, "RootItem" & $i)
ToolTip((500 - $i) & " items are created...")
Next
ToolTip("")
GUICtrlSetCursor($treeview, 2)
EndSwitch
WEnd

Exit


Function _GUICtrlTreeViewSetBkColor

Function Reference

_GUICtrlTreeViewSetBkColor

Sets the back color of a treeview control.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewSetBkColor($i_treeview, $v_RGBcolor)

Parameters

$i_treeview | controlID
$v_RGBcolor | New Hex text color

Return Value

Returns the previous Hex RGB Back Color of treeview.

Remarks

None.

Related

_GUICtrlTreeViewGetBkColor, _GUICtrlTreeViewGetLineColor, _GUICtrlTreeViewGetTextColor, _GUICtrlTreeViewSetLineColor, _GUICtrlTreeViewSetTextColor

Example

#include <GUIConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiStatusBar.au3>

opt("MustDeclareVars", 1)

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C
Global Const $White = 0xFFFFFF

Dim $myGui, $treeview, $generalitem, $displayitem, $aboutitem
Dim $compitem, $useritem, $resitem, $otheritem, $Status, $startlabel, $aboutlabel
Dim $compinfo, $msg, $cancelbutton

$myGui = GUICreate("TreeView Set Back Color", 392, 254)

$treeview = GUICtrlCreateTreeView(6, 6, 100, 150, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$generalitem = GUICtrlCreateTreeViewItem("General", $treeview)
$displayitem = GUICtrlCreateTreeViewItem("Display", $treeview)
$aboutitem = GUICtrlCreateTreeViewItem("About", $generalitem)
$compitem = GUICtrlCreateTreeViewItem("Computer", $generalitem)
$useritem = GUICtrlCreateTreeViewItem("User", $generalitem)
$resitem = GUICtrlCreateTreeViewItem("Resolution", $displayitem)
$otheritem = GUICtrlCreateTreeViewItem("Other", $displayitem)
$Status = _GuiCtrlStatusBarCreate($myGui, -1, "")
_GuiCtrlStatusBarSetSimple($Status)

$startlabel = GUICtrlCreateLabel("TreeView Demo", 190, 90, 100, 20)
$aboutlabel = GUICtrlCreateLabel("This little scripts demonstates the using of a treeview-control.", 190, 70, 100, 60)
GUICtrlSetState(-1, $GUI_HIDE)
$compinfo = GUICtrlCreateLabel("Name:" & @TAB & @ComputerName & @LF & "OS:" & @TAB & @OSVersion & @LF & "SP:" & @TAB & @OSServicePack, 120, 30, 200, 80)
GUICtrlSetState(-1, $GUI_HIDE)

$cancelbutton = GUICtrlCreateButton("Cancel", 180, 185, 70, 20)

_GuiCtrlStatusBarSetText($Status,"Previous Hex RGB Treeview Back Color: " & _GUICtrlTreeViewSetBkColor ($treeview, $Turquoise),255)
_GUICtrlTreeViewSetTextColor ($treeview, $Crimson)
_GUICtrlTreeViewSetLineColor ($treeview, $White)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE
ExitLoop

Case $msg = $generalitem
GUIChangeItems($aboutlabel, $compinfo, $startlabel, $startlabel)

Case $msg = $aboutitem
GUICtrlSetState($compinfo, $GUI_HIDE)
GUIChangeItems($startlabel, $startlabel, $aboutlabel, $aboutlabel)

Case $msg = $compitem
GUIChangeItems($startlabel, $aboutlabel, $compinfo, $compinfo)

EndSelect
WEnd

GUIDelete()
Exit

Func GUIChangeItems($hidestart, $hideend, $showstart, $showend)
Local $idx

For $idx = $hidestart To $hideend
GUICtrlSetState($idx, $GUI_HIDE)
Next
For $idx = $showstart To $showend
GUICtrlSetState($idx, $GUI_SHOW)
Next
EndFunc ;==>GUIChangeItems


Function _GUICtrlTreeViewSetIcon

Function Reference

_GUICtrlTreeViewSetIcon

Set an icon of the specified treeview item.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewSetIcon($i_treeview, $h_item, $s_iconfile = ""[, $i_iconID = 0[, $u_imagemode = 6]])

Parameters

$i_treeview | controlID
$h_item | item ID/handle to set the icon for
$s_iconfile | the file to extract the icon of
$i_iconID | the iconID to extract of the file
$u_imagemode | Optional: 2=normal image / 4=seletected image to set (default 6)

Return Value

Success: Returns TRUE.
Failure: Returns FALSE.

Remarks

At first use all items of the parent treeview will change to this icon if they have none! (See Example).

Related

None.

Example

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiTreeView.au3>

Opt("MustDeclareVars", 1)

Dim $h_GUI, $Msg, $treeview
Dim $h_root1, $h_root2, $h_root3
Dim $n_btn_seticon

$h_GUI = GUICreate("TreeView UDF Sample", 220, 340)

$treeview = GUICtrlCreateTreeView(10, 10, 200, 200, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetImage(-1, "shell32.dll", 3, 4)
GUICtrlSetImage(-1, "shell32.dll", 4, 2)

$h_root1 = _GUICtrlTreeViewInsertItem($treeview, "RootItem1")
_GUICtrlTreeViewSetIcon($treeview, $h_root1, "shell32.dll", 7)

$h_root2 = _GUICtrlTreeViewInsertItem($treeview, "RootItem2")
_GUICtrlTreeViewSetIcon($treeview, $h_root2, "shell32.dll", 12)

$h_root3 = _GUICtrlTreeViewInsertItem($treeview, "RootItem3")

$n_btn_seticon = GUICtrlCreateButton("Set Random Icons", 10, 220, 200, 20)

GUISetState()

While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
ExitLoop

Case $n_btn_seticon
_GUICtrlTreeViewSetIcon($treeview, $h_root1, "shell32.dll", Random(0, 50, 1))
_GUICtrlTreeViewSetIcon($treeview, $h_root2, "shell32.dll", Random(0, 50, 1))
EndSwitch
WEnd

Exit


Function _GUICtrlTreeViewSetIndent

Function Reference

_GUICtrlTreeViewSetIndent

Sets the width of indentation for a treeview control and redraws the control to reflect the new width.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewSetIndent($i_treeview, $i_indent)

Parameters

$i_treeview | controlID
$i_indent | Width, in pixels, of the indentation.

Return Value

None.

Remarks

$i_indent
If this parameter is less than the system-defined minimum width,
the new width is set to the system-defined minimum.

Related

_GUICtrlTreeViewGetIndent

Example

#include <GUIConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiStatusBar.au3>

opt("MustDeclareVars", 1)

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C
Global Const $White = 0xFFFFFF

Dim $myGui, $treeview, $generalitem, $displayitem, $aboutitem
Dim $compitem, $useritem, $resitem, $otheritem, $Status, $startlabel, $aboutlabel
Dim $compinfo, $msg, $cancelbutton

$myGui = GUICreate("TreeView Set Indent", 392, 254)

$treeview = GUICtrlCreateTreeView(6, 6, 100, 150, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$generalitem = GUICtrlCreateTreeViewItem("General", $treeview)
$displayitem = GUICtrlCreateTreeViewItem("Display", $treeview)
$aboutitem = GUICtrlCreateTreeViewItem("About", $generalitem)
$compitem = GUICtrlCreateTreeViewItem("Computer", $generalitem)
$useritem = GUICtrlCreateTreeViewItem("User", $generalitem)
$resitem = GUICtrlCreateTreeViewItem("Resolution", $displayitem)
$otheritem = GUICtrlCreateTreeViewItem("Other", $displayitem)
$Status = _GuiCtrlStatusBarCreate($myGui, -1, "")
_GuiCtrlStatusBarSetSimple($Status)

$startlabel = GUICtrlCreateLabel("TreeView Demo", 190, 90, 100, 20)
$aboutlabel = GUICtrlCreateLabel("This little scripts demonstates the using of a treeview-control.", 190, 70, 100, 60)
GUICtrlSetState(-1, $GUI_HIDE)
$compinfo = GUICtrlCreateLabel("Name:" & @TAB & @ComputerName & @LF & "OS:" & @TAB & @OSVersion & @LF & "SP:" & @TAB & @OSServicePack, 120, 30, 200, 80)
GUICtrlSetState(-1, $GUI_HIDE)

$cancelbutton = GUICtrlCreateButton("Cancel", 180, 185, 70, 20)

_GUICtrlTreeViewSetBkColor ($treeview, $Turquoise)
_GUICtrlTreeViewSetTextColor ($treeview, $Crimson)
_GUICtrlTreeViewSetLineColor ($treeview, $White)
_GUICtrlTreeViewSetIndent ($treeview, 10)
GUISetState()
_GuiCtrlStatusBarSetText($Status,"Indent: " & _GUICtrlTreeViewGetIndent ($treeview) & " in pixels",255)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE
ExitLoop

Case $msg = $generalitem
ConsoleWrite($generalitem & @LF)
GUIChangeItems($aboutlabel, $compinfo, $startlabel, $startlabel)

Case $msg = $aboutitem
GUICtrlSetState($compinfo, $GUI_HIDE)
GUIChangeItems($startlabel, $startlabel, $aboutlabel, $aboutlabel)

Case $msg = $compitem
GUIChangeItems($startlabel, $aboutlabel, $compinfo, $compinfo)

EndSelect
WEnd

GUIDelete()
Exit

Func GUIChangeItems($hidestart, $hideend, $showstart, $showend)
Local $idx

For $idx = $hidestart To $hideend
GUICtrlSetState($idx, $GUI_HIDE)
Next
For $idx = $showstart To $showend
GUICtrlSetState($idx, $GUI_SHOW)
Next
EndFunc ;==>GUIChangeItems


Function _GUICtrlTreeViewSetLineColor

Function Reference

_GUICtrlTreeViewSetLineColor

Sets the line color of a treeview control

#Include <GuiTreeView.au3>
_GUICtrlTreeViewSetLineColor($i_treeview, $v_RGBcolor)

Parameters

$i_treeview | controlID
$v_RGBcolor | New Hex text color

Return Value

Returns the previous Hex RGB line color of the control.

Remarks

None.

Related

_GUICtrlTreeViewGetBkColor, _GUICtrlTreeViewGetLineColor, _GUICtrlTreeViewGetTextColor, _GUICtrlTreeViewSetBkColor, _GUICtrlTreeViewSetTextColor

Example

#include <GUIConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiStatusBar.au3>

opt("MustDeclareVars", 1)

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C
Global Const $White = 0xFFFFFF

Dim $myGui, $treeview, $generalitem, $displayitem, $aboutitem
Dim $compitem, $useritem, $resitem, $otheritem, $Status, $startlabel, $aboutlabel
Dim $compinfo, $msg, $cancelbutton

$myGui = GUICreate("TreeView Set Line Color", 392, 254)

$treeview = GUICtrlCreateTreeView(6, 6, 100, 150, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$generalitem = GUICtrlCreateTreeViewItem("General", $treeview)
$displayitem = GUICtrlCreateTreeViewItem("Display", $treeview)
$aboutitem = GUICtrlCreateTreeViewItem("About", $generalitem)
$compitem = GUICtrlCreateTreeViewItem("Computer", $generalitem)
$useritem = GUICtrlCreateTreeViewItem("User", $generalitem)
$resitem = GUICtrlCreateTreeViewItem("Resolution", $displayitem)
$otheritem = GUICtrlCreateTreeViewItem("Other", $displayitem)
$Status = _GuiCtrlStatusBarCreate($myGui, -1, "")
_GuiCtrlStatusBarSetSimple($Status)

$startlabel = GUICtrlCreateLabel("TreeView Demo", 190, 90, 100, 20)
$aboutlabel = GUICtrlCreateLabel("This little scripts demonstates the using of a treeview-control.", 190, 70, 100, 60)
GUICtrlSetState(-1, $GUI_HIDE)
$compinfo = GUICtrlCreateLabel("Name:" & @TAB & @ComputerName & @LF & "OS:" & @TAB & @OSVersion & @LF & "SP:" & @TAB & @OSServicePack, 120, 30, 200, 80)
GUICtrlSetState(-1, $GUI_HIDE)

$cancelbutton = GUICtrlCreateButton("Cancel", 180, 185, 70, 20)

_GUICtrlTreeViewSetBkColor ($treeview, $Turquoise)
_GUICtrlTreeViewSetTextColor ($treeview, $Crimson)
_GuiCtrlStatusBarSetText($Status,"Previous Hex RGB Treeview Line Color: " & _GUICtrlTreeViewSetLineColor ($treeview, $White),255)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE
ExitLoop

Case $msg = $generalitem
GUIChangeItems($aboutlabel, $compinfo, $startlabel, $startlabel)

Case $msg = $aboutitem
GUICtrlSetState($compinfo, $GUI_HIDE)
GUIChangeItems($startlabel, $startlabel, $aboutlabel, $aboutlabel)

Case $msg = $compitem
GUIChangeItems($startlabel, $aboutlabel, $compinfo, $compinfo)

EndSelect
WEnd

GUIDelete()
Exit

Func GUIChangeItems($hidestart, $hideend, $showstart, $showend)
Local $idx

For $idx = $hidestart To $hideend
GUICtrlSetState($idx, $GUI_HIDE)
Next
For $idx = $showstart To $showend
GUICtrlSetState($idx, $GUI_SHOW)
Next
EndFunc ;==>GUIChangeItems


Function _GUICtrlTreeViewSetState

Function Reference

_GUICtrlTreeViewSetState

Set the state of the specified treeview item.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewSetState($i_treeview, $h_item, $i_state)

Parameters

$i_treeview | controlID
$h_item | item ID/handle to set the state for
$i_state | the new item state (default 0 - no change) (See Remarks).

Return Value

Success: Returns TRUE.
Failure: Returns FALSE.

Remarks

State table
State | Value
$TVIS_SELECTED | 2
$TVIS_CUT | 4
$TVIS_DROPHILITED | 8
$TVIS_BOLD | 16
$TVIS_EXPANDED | 32
$TVIS_EXPANDEDONCE | 64
$TVIS_EXPANDPARTIAL | 128

State values can BitOr'ed together as for example BitOr($TVIS_SELECTED, $TVIS_BOLD).

Related

_GUICtrlTreeViewGetState

Example

#include <GUIConstants.au3>
#include <GuiTreeView.au3>

Opt("MustDeclareVars", 1)

Dim $h_GUI, $Msg, $treeview, $h_search, $s_file, $h_item

$h_GUI = GUICreate("TreeView UDF Sample", 220, 220)

$treeview = GUICtrlCreateTreeView(10, 10, 200, 200, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetImage(-1, "shell32.dll", 3, 4)
GUICtrlSetImage(-1, "shell32.dll", 4, 2)

GUISetState()

$h_search = FileFindFirstFile("C:\*.*")
If $h_search <> -1 Then
While 1
$s_file = FileFindNextFile($h_search)
If @Error Then ExitLoop
If Not StringInStr(FileGetAttrib("C:\" & $s_file), "D") Then ContinueLoop
$h_item = _GUICtrlTreeViewInsertItem($treeview, $s_file)
If StringInStr(FileGetAttrib("C:\" & $s_file), "H") Then
_GUICtrlTreeViewSetState($treeview, $h_item, $TVIS_CUT)
EndIf
WEnd
EndIf

While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit


Function _GUICtrlTreeViewSetText

Function Reference

_GUICtrlTreeViewSetText

Set a new text to the specified treeview item.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewSetText($i_treeview, $h_item, $s_text)

Parameters

$i_treeview | controlID
$h_item | item ID/handle to get the text of
$s_text | the new item text

Return Value

Success: TRUE.
Failure: FALSE.

Remarks

None.

Related

None.

Example

#include <GUIConstants.au3>
#include <GuiTreeView.au3>

Opt("MustDeclareVars", 1)

Dim $h_GUI, $Msg, $treeview
Dim $h_root1, $h_root2, $h_root3
Dim $n_btn_settext

$h_GUI = GUICreate("TreeView UDF Sample", 220, 250)

$treeview = GUICtrlCreateTreeView(10, 10, 200, 200, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetImage(-1, "shell32.dll", 3, 4)
GUICtrlSetImage(-1, "shell32.dll", 4, 2)

$h_root1 = _GUICtrlTreeViewInsertItem($treeview, "RootItem1")
_GUICtrlTreeViewSetIcon($treeview, $h_root1, "shell32.dll", 7)

_GUICtrlTreeViewInsertItem($treeview, "SubItem1", $h_root1)
_GUICtrlTreeViewInsertItem($treeview, "SubItem2", $h_root1)

$h_root2 = _GUICtrlTreeViewInsertItem($treeview, "RootItem2")
_GUICtrlTreeViewSetIcon($treeview, $h_root2, "shell32.dll", 12)

$h_root3 = _GUICtrlTreeViewInsertItem($treeview, "RootItem3")
_GUICtrlTreeViewInsertItem($treeview, "SubItem3", $h_root3)
_GUICtrlTreeViewInsertItem($treeview, "SubItem4", $h_root3)

$n_btn_settext = GUICtrlCreateButton("Set text", 10, 220, 200, 20)

GUISetState()

While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
ExitLoop

Case $n_btn_settext
_GUICtrlTreeViewSetText($treeview, $h_root1, "New RootItem1 Text")
_GUICtrlTreeViewSetText($treeview, $h_root2, "New RootItem2 Text")

EndSwitch
WEnd

Exit


Function _GUICtrlTreeViewSetTextColor

Function Reference

_GUICtrlTreeViewSetTextColor

Sets the text color of a treeview control.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewSetTextColor($i_treeview, $v_RGBcolor)

Parameters

$i_treeview | controlID
$v_RGBcolor | New Hex text color

Return Value

Returns the previous Hex RGB text color of the control.

Remarks

None.

Related

_GUICtrlTreeViewGetBkColor, _GUICtrlTreeViewGetLineColor, _GUICtrlTreeViewGetTextColor, _GUICtrlTreeViewSetBkColor, _GUICtrlTreeViewSetLineColor

Example

#include <GUIConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiStatusBar.au3>

opt("MustDeclareVars", 1)

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C
Global Const $White = 0xFFFFFF

Dim $myGui, $treeview, $generalitem, $displayitem, $aboutitem
Dim $compitem, $useritem, $resitem, $otheritem, $Status, $startlabel, $aboutlabel
Dim $compinfo, $msg, $cancelbutton

$myGui = GUICreate("TreeView Set Text Color", 392, 254)

$treeview = GUICtrlCreateTreeView(6, 6, 100, 150, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$generalitem = GUICtrlCreateTreeViewItem("General", $treeview)
$displayitem = GUICtrlCreateTreeViewItem("Display", $treeview)
$aboutitem = GUICtrlCreateTreeViewItem("About", $generalitem)
$compitem = GUICtrlCreateTreeViewItem("Computer", $generalitem)
$useritem = GUICtrlCreateTreeViewItem("User", $generalitem)
$resitem = GUICtrlCreateTreeViewItem("Resolution", $displayitem)
$otheritem = GUICtrlCreateTreeViewItem("Other", $displayitem)
$Status = _GuiCtrlStatusBarCreate($myGui, -1, "")
_GuiCtrlStatusBarSetSimple($Status)

$startlabel = GUICtrlCreateLabel("TreeView Demo", 190, 90, 100, 20)
$aboutlabel = GUICtrlCreateLabel("This little scripts demonstates the using of a treeview-control.", 190, 70, 100, 60)
GUICtrlSetState(-1, $GUI_HIDE)
$compinfo = GUICtrlCreateLabel("Name:" & @TAB & @ComputerName & @LF & "OS:" & @TAB & @OSVersion & @LF & "SP:" & @TAB & @OSServicePack, 120, 30, 200, 80)
GUICtrlSetState(-1, $GUI_HIDE)

$cancelbutton = GUICtrlCreateButton("Cancel", 180, 185, 70, 20)

_GUICtrlTreeViewSetBkColor ($treeview, $Turquoise)
_GuiCtrlStatusBarSetText($Status,"Previous Hex RGB Treeview Text Color: " & _GUICtrlTreeViewSetTextColor ($treeview, $Crimson),255)
_GUICtrlTreeViewSetLineColor ($treeview, $White)

GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE
ExitLoop

Case $msg = $generalitem
GUIChangeItems($aboutlabel, $compinfo, $startlabel, $startlabel)

Case $msg = $aboutitem
GUICtrlSetState($compinfo, $GUI_HIDE)
GUIChangeItems($startlabel, $startlabel, $aboutlabel, $aboutlabel)

Case $msg = $compitem
GUIChangeItems($startlabel, $aboutlabel, $compinfo, $compinfo)

EndSelect
WEnd

GUIDelete()
Exit

Func GUIChangeItems($hidestart, $hideend, $showstart, $showend)
Local $idx

For $idx = $hidestart To $hideend
GUICtrlSetState($idx, $GUI_HIDE)
Next
For $idx = $showstart To $showend
GUICtrlSetState($idx, $GUI_SHOW)
Next
EndFunc ;==>GUIChangeItems


Function _GUICtrlTreeViewSort

Function Reference

_GUICtrlTreeViewSort

Sorts the items of a treeview control.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewSort($i_treeview)

Parameters

$i_treeview controlID

Return Value

None.

Remarks

None.

Related

None.

Example

#include <GuiTreeView.au3>

opt("MustDeclareVars", 1)
Dim $h_GUI, $treeview, $nItem1, $nItem2, $nItem3
Dim $nSubItem1, $nSubItem2, $nSubItem3, $nSubItem4, $nSubItem5, $nSubItem6, $nSubItem7
Dim $Btn_Sort, $Msg

$h_GUI = GUICreate("TreeView Sort", 392, 254)

$treeview = GUICtrlCreateTreeView(10, 10, 200, 150)
$nItem2 = GUICtrlCreateTreeViewItem("Item2", $treeview)
$nItem1 = GUICtrlCreateTreeViewItem("Item1", $treeview)
$nItem3 = GUICtrlCreateTreeViewItem("Item3", $treeview)
$nSubItem2 = GUICtrlCreateTreeViewItem("SubItem2", $nItem1)
$nSubItem1 = GUICtrlCreateTreeViewItem("SubItem1", $nItem1)
$nSubItem4 = GUICtrlCreateTreeViewItem("SubItem4", $nSubItem1)
$nSubItem5 = GUICtrlCreateTreeViewItem("SubItem5", $nSubItem4)
$nSubItem6 = GUICtrlCreateTreeViewItem("SubItem6", $nSubItem5)
$nSubItem3 = GUICtrlCreateTreeViewItem("SubItem3", $nSubItem1)
$nSubItem7 = GUICtrlCreateTreeViewItem("SubItem7", $nItem3)

$Btn_Sort = GUICtrlCreateButton("Sort", 70, 170, 90, 20)

GUISetState()

While 1
$Msg = GUIGetMsg()
Select
Case $Msg = $GUI_EVENT_CLOSE
ExitLoop
Case $Msg = $Btn_Sort
_GUICtrlTreeViewSort ($treeview)
EndSelect
WEnd

Exit


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: IE Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_IE_Example | Display a new browser window pre-loaded with documents to be used in IE.au3 examples
_IE_Introduction | Display introductory information about IE.au3 in a new browser window
_IE_VersionInfo | Returns an array of information about the IE.au3 version
_IEAction | Perform any of a set of simply actions on the Browser.
_IEAttach | Attach to the first existing instance of Internet Explorer where the search string sub-string matches based on the selected mode.
_IEBodyReadHTML | Returns the HTML inside the tag of the document.
_IEBodyReadText | Returns the Text inside the tag of the document.
_IEBodyWriteHTML | Replaces the HTML inside the tag of the document.
_IECreate | Create an Internet Explorer Browser Window.
_IECreateEmbedded | Create a Webbrowser object suitable for embedding in an AutoIt GUI with GuiCtrlCreateObj().
_IEDocGetObj | Given any DOM object, returns a reference to the associated document object.
_IEDocReadHTML | Returns the full HTML source of a document.
_IEDocWriteHTML | Replaces the HTML for the entire document.
_IEErrorHandlerDeRegister | Disable a registered user COM error handler
_IEErrorHandlerRegister | Register and enable a user COM error handler
_IEErrorNotify | Specifies whether IE.au3 automatically notifies of Warnings and Errors (to the console)
_IEFormElementCheckboxSelect | Set the value of a specified form element.
_IEFormElementGetCollection | Returns a collection object variable representing all Form Elements within a given Form.
_IEFormElementGetObjByName | Returns an object reference to a Form Element by name.
_IEFormElementGetValue | Returns the value of a given Form Element.
_IEFormElementOptionSelect | Set the value of a specified form element.
_IEFormElementRadioSelect | Set the value of a specified form element.
_IEFormElementSetValue | Set the value of a specified Form Element.
_IEFormGetCollection | Returns a collection object variable representing the Forms in the document.
_IEFormGetObjByName | Returns an object reference to a Form by name.
_IEFormImageClick | Simulate a mouse click on an <input type=image>. Match by sub-string match of alt text, name or src.
_IEFormReset | Reset a specified Form.
_IEFormSubmit | Submit a specified Form.
_IEFrameGetCollection | Returns a collection object containing the frames in a FrameSet or the iFrames on a normal page.
_IEFrameGetObjByName | Returns an object reference to a Frame by name.
_IEGetObjByName | Returns an object variable by name or id.
_IEHeadInsertEventScript | Inserts a Javascript into the Head of the document.
_IEImgClick | Simulate a mouse click on an image. Match by sub-string match of alt text, name, or src.
_IEImgGetCollection | Returns a collection object variable representing the IMG tags in the document.
_IEIsFrameSet | Checks to see if the specified Window contains a FrameSet.
_IELinkClickByIndex | Simulate a mouse click on a link by 0-based index (in source order).
_IELinkClickByText | Simulate a mouse click on a link with text sub-string matching the string provided.
_IELinkGetCollection | Returns a collection object containing all links in the document.
_IELoadWait | Wait for a browser page load to complete before returning.
_IELoadWaitTimeout | Retrieve or set the current value in milliseconds _IELoadWait will try before timing out.
_IENavigate | Directs an existing browser window to navigate to the specified URL.
_IEPropertyGet | Returns a select property of the Browser.
_IEPropertySet | Set a select property of the Browser.
_IEQuit | Close the browser and remove the object reference to it.
_IETableGetCollection | Returns a collection object variable representing all the tables in a document.
_IETableWriteToArray | Reads the contents of a Table into an array.
_IETagNameAllGetCollection | Returns a collection object all elements in the document or document hierarchy in source order.
_IETagNameGetCollection | Returns a collection object of all elements in the object with the specified TagName.


Function _IE_Example

Function Reference

_IE_Example

Display a new browser window pre-loaded with documents to be used in IE.au3 examples

#include <IE.au3>
_IE_Example ( [$s_module = "basic"] )

Parameters

$s_module Optional: specifies which module to run
basic = (Default) simple HTML page with text, links and images
form = simple HTML page with multiple form elements
frameset = simple HTML page with frames
iframe = simple HTML page with iframes
table = simple HTML page with tables

Return Value

Success: | Returns an object variable pointing to an InternetExplorer.Application object
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

This function displays browser windows pre-populated with HTML and HTML elements that are used throughout the helpfile and IE.au3 examples. You are also encouraged to use them to experiment with the IE.au3 function set.

Related

_IE_Introduction

Example

; *******************************************************
; Example 1 - Create browser windows with each of the example pages displayed.
; The object variable returned can be used just as the object
; variables returned by _IECreate or _IEAttach
; *******************************************************
;
#include <IE.au3>
$oIE_basic = _IE_Example ("basic")
$oIE_form = _IE_Example ("form")
$oIE_table = _IE_Example ("table")
$oIE_frameset = _IE_Example ("frameset")
$oIE_iframe = _IE_Example ("iframe")


Function _IE_Introduction

Function Reference

_IE_Introduction

Display introductory information about IE.au3 in a new browser window

#include <IE.au3>
_IE_Introduction ( [$s_module = "basic"] )

Parameters

$s_module Optional: specifies which module to run
basic = (Default) basic introduction

Return Value

Success: | Returns an object variable pointing to an InternetExplorer.Application object
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

The AutoIt Helpfile does not currently allow UDFs to have general documentation that covers a series of functions, but rather UDF documentation is focused on individual functions. This function is intended to provide that general documentation. It will grow over time.

Related

_IE_Example

Example

; *******************************************************
; Example 1 - Open a browser with the basic IE.au3 introductory text displayed
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Introduction ("basic")


Function _IE_VersionInfo

Function Reference

_IE_VersionInfo

Returns an array of information about the IE.au3 version

#include <IE.au3>
_IE_VersionInfo ( )

Parameters

None.

Return Value

Success: | Returns an array ($IEAU3VersionInfo)
 | $IEAU3VersionInfo[0] = Release Type (T=Test or V=Production)
 | $IEAU3VersionInfo[1] = Major Version
 | $IEAU3VersionInfo[2] = Minor Version
 | $IEAU3VersionInfo[3] = Sub Version
 | $IEAU3VersionInfo[4] = Release Date (YYYYMMDD)
 | $IEAU3VersionInfo[5] = Display Version (e.g. V2.0-0)
Failure: | None

Remarks

None.

Related

None.

Example

; *******************************************************
; Example 1 - Retrieve and display IE.au3 version information
; *******************************************************
;
#include <IE.au3>
$aVersion = _IE_VersionInfo ()
MsgBox(0, "IE.au3 Version", $aVersion[5] & " released " & $aVersion[4])


Function _IEAction

Function Reference

_IEAction

Perform any of a set of simply actions on the Browser.

#include <IE.au3>
_IEAction ( ByRef $o_object, $s_action )

Parameters

$o_object | Object variable of an InternetExplorer.Application
$s_action | Action selection (see remarks)

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

Action | Description
"back" | Navigates backward one item in the history list.
"blur" | Causes the element to lose focus, but does not set focus on the next element in the tab order.
"click" | Simulates a click on the specified element.
"copy" | Copies the current selection to the clipboard.
"cut" | Copies the current selection to the clipboard and then deletes it.
"delete" | Deletes the current selection.
"disable" | Disables the specified element.
"enable" | Enables the specified element.
"focus" | Causes the element to receive focus.
"forward" | Navigates forward one item in the history list.
"home" | Navigates to the current home or start page.
"invisible" | Sets an object state to hidden.
"paste" | Overwrites the contents of the clipboard on the current selection.
"print" | Opens the print dialog box so the user can print the current page.
"printdefault" | Print directly to default printer (no dialog)
"quit" | Closes the object.
"refresh" | Refreshes the current document.
"saveas" | Opens a dialog box to save the current Web page to a file.
"search" | Navigates to the current search page.
"selectall" | Selects the entire document.
"stop" | Cancels any pending navigation or download operation and stops any dynamic page elements, such as background sounds and animations.
"unselect" | Clears the current selection.
"visible" | Sets an object state to visible.

Related

None.

Example

; *******************************************************
; Example 1 - Open a browser with the "form" example, get a reference
; to the submit button by name and "click" it. This technique
; of submitting forms is useful because many forms rely on JavaScript
; code and "onClick" events on their submit button making _IEFormSubmit()
; not perform as expected
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oSubmit = _IEGetObjByName ($oIE, "submitExample")
_IEAction ($oSubmit, "click")
_IELoadWait ($oIE)


Function _IEAttach

Function Reference

_IEAttach

Attach to the first existing instance of Internet Explorer where the search string sub-string matches based on the selected mode.

#include <IE.au3>
_IEAttach ( $s_string [, $s_mode = "Title"] )

Parameters

$s_string | String to search for (for "embedded" or "dialogbox", use Title sub-string or HWND of window)
$s_mode | Optional: specifies search mode Title = (Default) browser title URL = url of the current page Text = text from the body of the current page HTML = html from the body of the current page HWND = hwnd of the browser window Embedded = title sub-string or hwnd of of the window embedding the control DialogBox = title sub-string or hwnd of modal/modeless dialogbox

Return Value

Success: | Returns an object variable pointing to the IE Window Object
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

_IEAttach provides the "DialogBox" parameter to attach to modal and modeless dialogs created by the browser. It is important to note that not all dialogs created through browser interaction can be attached to and controlled in this way. Many of these dialogs are actually standard windows and can be controlled through the traditional AutoIt window functions. A reliable way to tell the difference between these types of windows is to use the "AutoIt Window Info" tool to examine it -- if the window contains a control called "Internet Explorer_Server1" then you can attach to it with this function, if it does not it is a standard window and traditional AutoIt windows functions must be used to control it.

Related

_IECreate, _IECreateEmbedded, _IEQuit

Example

; *******************************************************
; Example 1 - Attach to a browser with "AutoIt" in its title, display the URL
; *******************************************************
;
#include <IE.au3>
$oIE = _IEAttach ("AutoIt")
MsgBox(0, "The URL", _IEPropertyGet ($oIE, "locationurl"))

; *******************************************************
; Example 2 - Attach to a browser with "The quick brown fox"
; in the text of it's top-level document
; *******************************************************
;
#include <IE.au3>
$oIE = _IEAttach ("The quick brown fox", "text")

; *******************************************************
; Example 3 - ; Attach to a browser control embedded in another window
; *******************************************************
;
#include <IE.au3>
$oIE = _IEAttach ("A Window Title", "embedded")


Function _IEBodyReadHTML

Function Reference

_IEBodyReadHTML

Returns the HTML inside the tag of the document.

#include <IE.au3>
_IEBodyReadHTML ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application, Window or Frame object

Return Value

Success: | Returns HTML included in the of the docuement
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
@Extended: | Contains invalid parameter number

Remarks

This function uses the .innerHTML property of the document Body. .innerHTML is available for nearly all DOM elements.

Related

_IEBodyReadText, _IEBodyWriteHTML

Example

; *******************************************************
; Example 1 - Open a browser with the basic example, ready the body HTML,
; append new HTML to the original and write it back to the browser
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
$sHTML = _IEBodyReadHTML ($oIE)
$sHTML = $sHTML & "<p><font color=red size=+5>Big RED text!</font>"
_IEBodyWriteHTML ($oIE, $sHTML)


Function _IEBodyReadText

Function Reference

_IEBodyReadText

Returns the Text inside the tag of the document.

#include <IE.au3>
_IEBodyReadText ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application, Window or Frame object

Return Value

Success: | Returns the Text included in the of the docuement
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
@Extended: | Contains invalid parameter number

Remarks

This function uses the .innerText property of the document Body. .innerText is available for nearly all DOM elements and is a fast convenient method of parsing out just the text in a document.

Related

_IEBodyReadHTML, _IEBodyWriteHTML

Example

; *******************************************************
; Example 1 - Open a browser with the basic example, read the body Text
; (the content with all HTML tags removed) and display it in a MsgBox
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
$sText = _IEBodyReadText ($oIE)
MsgBox(0, "Body Text", $sText)


Function _IEBodyWriteHTML

Function Reference

_IEBodyWriteHTML

Replaces the HTML inside the tag of the document.

#include <IE.au3>
_IEBodyWriteHTML ( ByRef $o_object, $s_html )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_html | The HTML string to write to the document

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_IEBodyReadHTML, _IEBodyReadText

Example

; *******************************************************
; Example 1 - Open a browser with the iFrame example, get a reference
; to the iFrame with a name of "iFrameTwo" and replace its body HTML
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("iframe")
$oFrame = _IEFrameGetObjByName ($oIE, "iFrameTwo")
_IEBodyWriteHTML ($oFrame, "Hello <b>iFrame!</b>")


Function _IECreate

Function Reference

_IECreate

Create an Internet Explorer Browser Window.

#include <IE.au3>
_IECreate ( [$s_Url = "about:blank" [, $f_tryAttach = 0 [, $f_visible = 1 [, $f_wait = 1 [, $f_takeFocus = -1]]]]] )

Parameters

$s_Url | Optional: specifies the Url to navigate to upon creation
$f_tryAttach | Optional: specifies whether to try to attach to an existing window 0 = (Default) do not try to attach 1 = Try to attach to an existing window
$f_visible | Optional: specifies whether the browser window will be visible 0 = Browser Window is hidden 1 = (Default) Browser Window is visible
$f_wait | Optional: specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning
$f_takeFocus | Optional: specifies whether to bring the attached window to focus 0 = Bring window into focus -1 = (Default) do not bring window into focus

Return Value

Success: | Returns an object variable pointing to an InternetExplorer.Application object
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
@Extended: | Set to true (1) or false (0) depending on the success of $f_tryAttach

Remarks

None.

Related

_IEAttach, _IECreateEmbedded, _IEQuit

Example

; *******************************************************
; Example 1 - Create a browser window and navigate to a website
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("www.autoitscript.com")

; *******************************************************
; Example 2 - Create new browser windows pointing to each of 3 different URLs
; if one does not already exist ($f_tryAttach = 1)
; do not wait for the page loads to complete ($f_wait = 0)
; *******************************************************
;
#include <IE.au3>
_IECreate ("www.autoitscript.com", 1, 1, 0)
_IECreate ("my.yahoo.com", 1, 1, 0)
_IECreate ("www.google.com", 1, 1, 0)

; *******************************************************
; Example 3 - Attempt to attach to an existing browser displaying a particular website URL
; Create a new browser and navigate to that site if one does not already exist
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("www.autoitscript.com", 1)
; Check @extended return value to see if attach was successful
If @extended Then
MsgBox(0, "", "Attached to Existing Browser")
Else
MsgBox(0, "", "Created New Browser")
EndIf

; *******************************************************
; Example 4 - Create an empty browser window and populate it with custom HTML
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ()
$sHTML = "<h1>Hello World!</h1>"
_IEBodyWriteHTML ($oIE, $sHTML)

; *******************************************************
; Example 5 - Create an invisible browser window, navigate to a website,
; retrieve some information and Quit
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://sourceforge.net", 0, 0)
; Display the innerText on an element on the page with a name of "sfmarquee"
$oMarquee = _IEGetObjByName ($oIE, "sfmarquee")
MsgBox(0, "SourceForge Information", $oMarquee.innerText)
_IEQuit ($oIE)


Function _IECreateEmbedded

Function Reference

_IECreateEmbedded

Create a Webbrowser object suitable for embedding in an AutoIt GUI with GuiCtrlCreateObj().

#include <IE.au3>
_IECreateEmbedded ( )

Parameters

None.

Return Value

Success: | Returns a Webbrowser object reference
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error

Remarks

No actions can be performed on this object until it has been embedded into a parent application (e.g. you cannot perform an _IENavigate).

There are several properties related to an InternetExplorer object (e.g. returned by _IECreate) that do not apply to this object. These include status text, addressbar and others that may exist for a browser, but do not exist for an embedded control.

_IEQuit cannot be used with this object. The object will be destroyed when its parent GUI is destroyed.

Related

GUICtrlCreateObj, _IEAttach, _IECreate

Example

; *******************************************************
; Example 1 - Trap COM errors so that 'Back' and 'Forward'
; outside of history bounds does not abort script
; (expect COM errors to be sent to the console)
; *******************************************************
;
#include <GUIConstants.au3>
#include <IE.au3>

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()
GUICreate("Embedded Web control Test", 640, 580, _
(@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360)
$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
$GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
$GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

GUISetState() ;Show GUI

_IENavigate ($oIE, "http://www.autoitscript.com")

; Waiting for user to close the window
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $GUI_Button_Home
_IENavigate ($oIE, "http://www.autoitscript.com")
Case $msg = $GUI_Button_Back
_IEAction ($oIE, "back")
Case $msg = $GUI_Button_Forward
_IEAction ($oIE, "forward")
Case $msg = $GUI_Button_Stop
_IEAction ($oIE, "stop")
EndSelect
WEnd

GUIDelete()

Exit


Function _IEDocGetObj

Function Reference

_IEDocGetObj

Given any DOM object, returns a reference to the associated document object.

#include <IE.au3>
_IEDocGetObj ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application, Window or Frame object

Return Value

Success: | Returns an object variable pointing to the Document object
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
@Extended: | Contains invalid parameter number

Remarks

Given any DOM object (e.g. Browser, Window, Frame, iFrame, Document or Document Element) this will return a reference to the associated document object. It is particularly useful when writing generalized functions when you cannot control the type of object that will be passed in.

Related

None.

Example

; *******************************************************
; Example 1 - Open a browser to the AutoIt Homepage, get a reference
; to the document object and display a document attribute
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com")
$oDoc = _IEDocGetObj ($oIE)
MsgBox(0, "Document Created Date", $oDoc.fileCreatedDate)


Function _IEDocReadHTML

Function Reference

_IEDocReadHTML

Returns the full HTML source of a document.

#include <IE.au3>
_IEDocReadHTML ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application, Window or Frame object

Return Value

Success: | Returns the HTML included in the of the docuement, including the and tags
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_IEDocWriteHTML

Example

; *******************************************************
; Example 1 - Open a browser with the basic example, read the document HTML
; (all HTML including the <HEAD> and script) and display it in a MsgBox
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
$sHTML = _IEDocReadHTML ($oIE)
MsgBox(0, "Document Source", $sHTML)


Function _IEDocWriteHTML

Function Reference

_IEDocWriteHTML

Replaces the HTML for the entire document.

#include <IE.au3>
_IEDocWriteHTML ( ByRef $o_object, $s_html )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_html | The HTML string to write to the document

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
@Extended: | Contains invalid parameter number

Remarks

This function completely replaces the content of the document in a browser or a frame. It can be used to create a new page with custom HTML and JavaScript.

It is sometimes necessary to refresh the page after writing with _IEAction($oIE, "refresh") (e,g, after creating a FRAMESET).

Related

_IEDocReadHTML

Example

; *******************************************************
; Example 1 - Create an empty browser, write customer HTML to it - in this case a
; FRAMESET - and then update the contents of each of the frames
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ()
$sHTML = ""
$sHTML &= "<HTML>" & @CR
$sHTML &= "<HEAD>" & @CR
$sHTML &= "<TITLE>_IE_Example('frameset')</TITLE>" & @CR
$sHTML &= "</HEAD>" & @CR
$sHTML &= "<FRAMESET rows='25,200'>" & @CR
$sHTML &= " <FRAME NAME=Top SRC=about:blank>" & @CR
$sHTML &= " <FRAMESET cols='100,500'>" & @CR
$sHTML &= " <FRAME NAME=Menu SRC=about:blank>" & @CR
$sHTML &= " <FRAME NAME=Main SRC=about:blank>" & @CR
$sHTML &= " </FRAMESET>" & @CR
$sHTML &= "</FRAMESET>" & @CR
$sHTML &= "</HTML>"
_IEDocWriteHTML ($oIE, $sHTML)
_IEAction ($oIE, "refresh")
Local $oFrameTop = _IEFrameGetObjByName ($oIE, "Top")
Local $oFrameMenu = _IEFrameGetObjByName ($oIE, "Menu")
Local $oFrameMain = _IEFrameGetObjByName ($oIE, "Main")
_IEBodyWriteHTML ($oFrameTop, '$oFrameTop = _IEFrameGetObjByName($oIE, "Top")')
_IEBodyWriteHTML ($oFrameMenu, '$oFrameMenu = _IEFrameGetObjByName($oIE, "Menu")')
_IEBodyWriteHTML ($oFrameMain, '$oFrameMain = _IEFrameGetObjByName($oIE, "Main")')


Function _IEErrorHandlerDeRegister

Function Reference

_IEErrorHandlerDeRegister

Disable a registered user COM error handler

#include <IE.au3>
_IEErrorHandlerDeRegister ( )

Parameters

None.

Return Value

Success: | Returns 1
Failure: | None

Remarks

See remarks for _IEErrorHandlerRegister.

Related

_IEErrorHandlerRegister

Example

; *******************************************************
; Example 1 - Register and later deregister a custom error handler
; *******************************************************
;
#include <IE.au3>
; Register a customer error handler
_IEErrorHandlerRegister ("MyErrFunc")
; Do something
; Deregister the customer error handler
_IEErrorHandlerDeregister ()
; Do something else

Exit

Func MyErrFunc()
$HexNumber = Hex($oIEErrorHandler.number, 8)
MsgBox(0, "", "We intercepted a COM Error !" & @CRLF & _
"Number is: " & $HexNumber & @CRLF & _
"Windescription is: " & $oIEErrorHandler.windescription)
SetError(1) ; something to check for when this function returns
EndFunc ;==>MyErrFunc


Function _IEErrorHandlerRegister

Function Reference

_IEErrorHandlerRegister

Register and enable a user COM error handler

#include <IE.au3>
_IEErrorHandlerRegister ( [$s_functionName = "__IEInternalErrorHandler"] )

Parameters

$s_functionName String variable with the name of a user-defined COM error handler, defaults to the internal COM error handler in this UDF

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
@Extended: | Contains invalid parameter number

Remarks

Important: When using your own error handler, the Error Object variable used MUST be named $oIEErrorHandler (see example).

AutoIt has the ability to trap COM errors and pass then through a custom error handler using the ObjEvent function. There is a problem with this for UDF writers however because only a single COM error handler can be in use at a time. For the UDF to use a COM error handler it must first deregister the user error handler, install its own and then put the user handler back in place. Unfortunately, by default, the UDF has no way to access the handle of the user error handler.

Using this routine you can register your COM error handler in a way that IE.au3 can gracefully remove and reinstate it when it needs to. You may either point to your own customer error handler or you may use the one developed for IE.au3 (the default). Using the default IE.au3 error handler you will also get some nice diagnostic information written to the console and some global variables that contain information about the trapped errors.

If you instantiate your own COM error handler without using this routine IE.au3 will not be able to trap some COM errors and you may experience some abrupt script terminations as a result.

Related

_IEErrorHandlerDeRegister

Example

; *******************************************************
; Example 1 - Register and later deregister a custom and the default IE.au3 error handler
; *******************************************************
;
#include <IE.au3>
; Register a customer error handler
_IEErrorHandlerRegister ("MyErrFunc")
; Do something
; Deregister the customer error handler
_IEErrorHandlerDeregister ()
; Do something else
; Register the default IE.au3 COM Error Handler
_IEErrorHandlerRegister ()
; Do more work

Exit

Func MyErrFunc()
; Important: the error object variable MUST be named $oIEErrorHandler
$ErrorScriptline = $oIEErrorHandler.scriptline
$ErrorNumber = $oIEErrorHandler.number
$ErrorNumberHex = Hex($oIEErrorHandler.number, 8)
$ErrorDescription = StringStripWS($oIEErrorHandler.description, 2)
$ErrorWinDescription = StringStripWS($oIEErrorHandler.WinDescription, 2)
$ErrorSource = $oIEErrorHandler.Source
$ErrorHelpFile = $oIEErrorHandler.HelpFile
$ErrorHelpContext = $oIEErrorHandler.HelpContext
$ErrorLastDllError = $oIEErrorHandler.LastDllError
$ErrorOutput = ""
$ErrorOutput &= "--> COM Error Encountered in " & @ScriptName & @CR
$ErrorOutput &= "----> $ErrorScriptline = " & $ErrorScriptline & @CR
$ErrorOutput &= "----> $ErrorNumberHex = " & $ErrorNumberHex & @CR
$ErrorOutput &= "----> $ErrorNumber = " & $ErrorNumber & @CR
$ErrorOutput &= "----> $ErrorWinDescription = " & $ErrorWinDescription & @CR
$ErrorOutput &= "----> $ErrorDescription = " & $ErrorDescription & @CR
$ErrorOutput &= "----> $ErrorSource = " & $ErrorSource & @CR
$ErrorOutput &= "----> $ErrorHelpFile = " & $ErrorHelpFile & @CR
$ErrorOutput &= "----> $ErrorHelpContext = " & $ErrorHelpContext & @CR
$ErrorOutput &= "----> $ErrorLastDllError = " & $ErrorLastDllError
MsgBox(0,"COM Error", $ErrorOutput)
SetError(1)
Return
EndFunc ;==>MyErrFunc


Function _IEErrorNotify

Function Reference

_IEErrorNotify

Specifies whether IE.au3 automatically notifies of Warnings and Errors (to the console)

#include <IE.au3>
_IEErrorNotify ( [$f_notify = -1] )

Parameters

$f_notify Optional: specifies whether notification should be on or off
-1 = (Default) return current setting
True = Turn On
False = Turn Off

Return Value

Success: | If $f_notify = -1, returns the current notification setting, else returns 1
Failure: | Returns 0

Remarks

IE.au3 writes diagnostic information, warnings and errors to the console by default. This information can readily be seen when using the SciTe editor to run your scripts.

This function allows you to turn this functionality on or off.

Related

None.

Example

; *******************************************************
; Example 1 - Check the current status of _IEErrorNotif, turn it off if on, on if off
; *******************************************************
;
#include <IE.au3>
If _IEErrorNotify () Then
MsgBox(0, "_IEErrorNotify Status", "Notification is ON, turning it OFF")
_IEErrorNotify (1)
Else
MsgBox(0, "_IEErrorNotify Status", "Notification is OFF, turning it ON")
_IEErrorNotify (0)
EndIf


Function _IEFormElementCheckBoxSelect

Function Reference

_IEFormElementCheckBoxSelect

Set the value of a specified form element.

#include <IE.au3>
_IEFormElementCheckBoxSelect ( ByRef $o_object, $s_string [, $s_name = "" [, $f_select = 1 [, $s_mode = "byValue" [, $f_fireEvent = 1]]]] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Form object
$s_string | Value used to match element - treatment based on $s_mode
$s_name | Optional: Name or Id of checkbox(es)
$f_select | Optional: specifies whether element should be checked or unchecked -1 = Return checked state 0 = Uncheck the element 1 = (Default) Check the element
$s_mode | Optional: specify search mode byValue = (Default) value of the checkbox you wish to select byIndex = 0-based index of checkbox you wish to select
$f_fireEvent | Optional: specifies whether to fire an OnChange event after changing value 0 = do not fire OnChange event after setting value 1 = (Default) fire OnChange event after setting value

Return Value

Success: | If $f_select = -1, returns the current checked state, else returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

The $f_fireEvent parameter is significant only if the form element has an onChange event associated with it.

$s_Name is optional for this function. If it is omitted, the function will operate on a collection of all <input type=checkbox> elements in the form. If specified, the function will operate on a collection of <input type=checkbox> elements with that name.

Related

_IEFormElementOptionSelect, _IEFormElementRadioSelect

Example

; *******************************************************
; Example 1 - Open a browser with the form example, get reference to form, select and
; deselect the checkboxes byValue. Since $s_Name is not specified, operate
; on the collection of all <input type=checkbox> elements in the form
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
_IEFormElementCheckboxSelect ($oForm, "gameBasketball", "", 1, "byValue")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, "gameFootball", "", 1, "byValue")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, "gameTennis", "", 1, "byValue")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, "gameBaseball", "", 1, "byValue")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, "gameBasketball", "", 0, "byValue")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, "gameFootball", "", 0, "byValue")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, "gameTennis", "", 0, "byValue")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, "gameBaseball", "", 0, "byValue")
Sleep(1000)
Next

; *******************************************************
; Example 2 - Open a browser with the form example, get reference to form, select and
; deselect the checkboxes byIndex. Since $s_Name is not specified, operate
; on the collection of all <input type=checkbox> elements in the form
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
_IEFormElementCheckboxSelect ($oForm, 3, "", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 2, "", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 1, "", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 0, "", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 3, "", 0, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 2, "", 0, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 1, "", 0, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 0, "", 0, "byIndex")
Sleep(1000)
Next

; *******************************************************
; Example 3 - Open a browser with the form example, get reference to form, select and
; deselect the checkboxes byIndex in the group that shares the name checkboxG2Example
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
_IEFormElementCheckboxSelect ($oForm, 0, "checkboxG2Example", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 1, "checkboxG2Example", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 0, "checkboxG2Example", 0, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 1, "checkboxG2Example", 0, "byIndex")
Sleep(1000)
Next


Function _IEFormElementGetCollection

Function Reference

_IEFormElementGetCollection

Returns a collection object variable representing all Form Elements within a given Form.

#include <IE.au3>
_IEFormElementGetCollection ( ByRef $o_object [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Form object
$i_index | Optional: specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object variable containing the Form Elements collection, @EXTENDED = form element count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

None.

Example

; *******************************************************
; Example 1 - Get a reference to a specific form element by 0-based index.
; In this case, submit a query to the Google search engine
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 1)
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)


Function _IEFormElementGetObjByName

Function Reference

_IEFormElementGetObjByName

Returns an object reference to a Form Element by name.

#include <IE.au3>
_IEFormElementGetObjByName ( ByRef $o_object, $s_name [, $i_index = 0] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Form object
$s_name | Specifies the name of the Form Element you wish to match
$i_index | Optional: If the Form Element name occurs more than once, specifies instance by 0-based index 0 (Default) or positive integer returns an indexed instance -1 returns a collection of the specified Form Elements

Return Value

Success: | Returns an object variable pointing to the Form Element object, @EXTENDED = form count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

None.

Example

; *******************************************************
; Example 1 - Get a reference to a specific form element by name.
; In this case, submit a query to the Google search engine
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)


Function _IEFormElementGetValue

Function Reference

_IEFormElementGetValue

Returns the value of a given Form Element.

#include <IE.au3>
_IEFormElementGetValue ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application, Form Element object

Return Value

Success: | Returns the string value of the given Form Element
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

See remarks for _IEFormElementSetValue.

Related

_IEFormElementSetValue, _IEFormElementGetCollection, _IEFormElementGetObjByName, _IEFormElementOptionSelect, _IEFormElementCheckboxSelect, _IEFormElementRadioSelect

Example

; *******************************************************
; Example 1 - Open a browser with the form example, set the value of a text
; form element, retrieve and display the value from the element
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oText = _IEFormElementGetObjByName ($oForm, "textExample")
$IEAu3Version = _IE_VersionInfo ()
_IEFormElementSetValue ($oText, $IEAu3Version[5])
MsgBox(0, "Form Element Value", _IEFormElementGetValue ($oText))


Function _IEFormElementOptionSelect

Function Reference

_IEFormElementOptionSelect

Set the value of a specified form element.

#include <IE.au3>
_IEFormElementOptionSelect ( ByRef $o_object, $s_string [, $f_select = 1 [, $s_mode = "byValue" [, $f_fireEvent = 1]]] )

Parameters

$o_object | Form Element Object of type "Select Option"
$s_string | Value used to match element - treatment based on $s_mode
$f_select | Optional: specifies whether element should be selected or deselected -1 = Return selected state 0 = Deselect the element 1 = (Default) Select the element
$s_mode | Optional: specifies search mode byValue = (Default) value of the option you wish to select byText = text of the option you wish to select byIndex = 0-based index of option you wish to select
$f_fireEvent | Optional: specifies whether to fire an OnChange event after changing value 0 = do not fire OnChange event after setting value 1 = (Default) fire OnChange event after setting value

Return Value

Success: | If $f_select = -1, returns the current selected state, else returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

The $f_fireEvent parameter is significant only if the form element has an onChange event associated with it.

Related

_IEFormElementCheckBoxSelect, _IEFormElementRadioSelect

Example

; *******************************************************
; Example 1 - Open a browser with the form example, get reference to form, get reference
; to select element, cycle 10 times selecting options byValue, byText and byIndex
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oSelect = _IEFormElementGetObjByName ($oForm, "selectExample")
For $i = 1 To 10
_IEFormElementOptionSelect ($oSelect, "Freepage", 1, "byText")
Sleep(1000)
_IEFormElementOptionSelect ($oSelect, "midipage.html", 1, "byValue")
Sleep(1000)
_IEFormElementOptionSelect ($oSelect, 0, 1, "byIndex")
Sleep(1000)
Next

; *******************************************************
; Example 2 - Open a browser with the form example, get reference to form, get reference
; to select multiple element, cycle 5 times selecting and then deselecting
; options byValue, byText and byIndex.
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oSelect = _IEFormElementGetObjByName ($oForm, "multipleSelectExample")
For $i = 1 To 5
_IEFormElementOptionSelect ($oSelect, "Carlos", 1, "byText")
Sleep(1000)
_IEFormElementOptionSelect ($oSelect, "Name2", 1, "byValue")
Sleep(1000)
_IEFormElementOptionSelect ($oSelect, 5, 1, "byIndex")
Sleep(1000)
_IEFormElementOptionSelect ($oSelect, "Carlos", 0, "byText")
Sleep(1000)
_IEFormElementOptionSelect ($oSelect, "Name2", 0, "byValue")
Sleep(1000)
_IEFormElementOptionSelect ($oSelect, 5, 0, "byIndex")
Sleep(1000)
Next

; *******************************************************
; Example 3 - Open a browser with the form example, get reference to form, get reference
; to select element, check to see if the option "Freepage" is selected and
; report result. Repeat for the option with index 0 and for the option
; with value of 'midipage.html'
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oSelect = _IEFormElementGetObjByName ($oForm, "selectExample")
If _IEFormElementOptionSelect ($oSelect, "Freepage", -1, "byText") Then
MsgBox(0, "Option Selected", "Option Freepage is selected")
Else
MsgBox(0, "Option Selected", "Option Freepage is Not selected")
EndIf
If _IEFormElementOptionSelect ($oSelect, 0, -1, "byIndex") Then
MsgBox(0, "Option Selected", "The First (index 0) option is selected")
Else
MsgBox(0, "Option Selected", "The First (index 0) option is Not selected")
EndIf
If _IEFormElementOptionSelect ($oSelect, "midipage.html", -1, "byValue") Then
MsgBox(0, "Option Selected", "The option with value 'midipage.html' is selected")
Else
MsgBox(0, "Option Selected", "The option with value 'midipage.html' is NOT selected")
EndIf


Function _IEFormElementRadioSelect

Function Reference

_IEFormElementRadioSelect

Set the value of a specified form element.

#include <IE.au3>
_IEFormElementRadioSelect ( ByRef $o_object, $s_string , $s_name [, $f_select = 1 [, $s_mode = "byValue" [, $f_fireEvent = 1]]] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Form object
$s_string | Value used to match element - treatment based on $s_mode
$s_name | Name or Id of Radio Group
$f_select | Optional: specifies whether element should be selected or deselected -1 = Return selected state 0 = Unselect the element 1 = (Default) Select the element
$s_mode | Optional: specifies search mode byValue = (Default) value of the radio you wish to select byIndex = 0-based index of radio you wish to select
$f_fireEvent | Optional: specifies whether to fire an OnChange event after changing value 0 = do not fire OnChange event after setting value 1 = (Default) fire OnChange event after setting value

Return Value

Success: | If $f_select = -1, returns the current selected state, else returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

The $f_fireEvent parameter is significant only if the form element has an onChange event associated with it.

$s_Name is a mandatory parameter for this function. Radio buttons are operated upon in groups sharing the same name. No more than one element within a group may be selected at a given time - when one item is selected, all others are deselected.

Related

_IEFormElementOptionSelect, _IEFormElementCheckBoxSelect

Example

; *******************************************************
; Example 1 - Open a browser with the form example, get reference to form, select
; each radio button byValue, then deselect the last item leaving none selected.
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
_IEFormElementRadioSelect ($oForm, "vehicleAirplane", "radioExample", 1, "byValue")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, "vehicleTrain", "radioExample", 1, "byValue")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, "vehicleBoat", "radioExample", 1, "byValue")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, "vehicleCar", "radioExample", 1, "byValue")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, "vehicleCar", "radioExample", 0, "byValue")
Sleep(1000)
Next

; *******************************************************
; Example 2 - Open a browser with the form example, get reference to form, select
; each radio button byIndex, then deselect the last item leaving none selected.
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
_IEFormElementRadioSelect ($oForm, 3, "radioExample", 1, "byIndex")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, 2, "radioExample", 1, "byIndex")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, 1, "radioExample", 1, "byIndex")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, 0, "radioExample", 1, "byIndex")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, 0, "radioExample", 0, "byIndex")
Sleep(1000)
Next


Function _IEFormElementSetValue

Function Reference

_IEFormElementSetValue

Set the value of a specified Form Element.

#include <IE.au3>
_IEFormElementSetValue ( ByRef $o_object, $s_newvalue [, $f_fireEvent = 1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Form Element object
$s_newvalue | The new value to be set into the Form Element
$f_fireEvent | Optional: specifies whether to fire an OnChange event after changing value 0 = Do not fire OnChange event after setting value 1 = (Default) fire OnChange event after setting value

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

While all Form Elements have a value, only text oriented elements use their value attribute in an obvious fashion (type text, textarea, hidden, password and file). The value of other form elements does not affect what is displayed in the user interface, but rather the value that is returned by the element when it is selected or activated.

See _IEFormElementOptionSelect, _IEFormElementCheckboxSelect, _IEFormElementRadioSelect and _IEFormImageClick for more information.

Related

_IEFormElementGetValue, _IEFormElementGetCollection, _IEFormElementGetObjByName, _IEFormElementOptionSelect, _IEFormElementCheckboxSelect, _IEFormElementRadioSelect

Example

; *******************************************************
; Example 1 - Open a browser with the form example, set the value of a text form element
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oText = _IEFormElementGetObjByName ($oForm, "textExample")
_IEFormElementSetValue ($oText, "Hey! This works!")

; *******************************************************
; Example 2 - Get a reference to a specific form element and set its value.
; In this case, submit a query to the Google search engine
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)

; *******************************************************
; Example 3 - Login to Hotmail
; *******************************************************
;
#include <IE.au3>
; Create a browser window and navigate to hotmail
$oIE = _IECreate ("http://www.hotmail.com")

; get pointers to the login form and username, password and signin fields
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")

$username = "your username here"
$password = "your password here"

; Set field values and submit the form
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")


Function _IEFormGetCollection

Function Reference

_IEFormGetCollection

Returns a collection object variable representing the Forms in the document.

#include <IE.au3>
_IEFormGetCollection ( ByRef $o_object [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window, Frame or iFrame object
$i_index | Optional: specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object variable with a collection of all forms in the document, @EXTENDED = form count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

None.

Example

; *******************************************************
; Example 1 - Get a reference to a specific form by 0-based index,
; in this case the first form on the page
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 1)
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)

; *******************************************************
; Example 2 - Get a reference to the collection of forms on a page,
; and then loop through them displaying information for each
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com")
$oForms = _IEFormGetCollection ($oIE)
MsgBox(0, "Forms Info", "There are " & @extended & " forms on this page")
For $oForm In $oForms
MsgBox(0, "Form Info", $oForm.name)
Next


Function _IEFormGetObjByName

Function Reference

_IEFormGetObjByName

Returns an object reference to a Form by name.

#include <IE.au3>
_IEFormGetObjByName ( ByRef $o_object, $s_name [, $i_index = 0] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_name | Specifies the name of the Form you wish to match
$i_index | Optional: If Form name occurs more than once, specifies instance by 0-based index 0 (Default) or positive integer returns an indexed instance -1 returns a collection of the specified Forms

Return Value

Success: | Returns an object variable pointing to the Form object, @EXTENDED = form count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

None.

Example

; *******************************************************
; Example 1 - Get a reference to a specific form by name. In this case, submit a query
; to the Google search engine. Note that the names of the form and form
; elements can be found by viewing the page HTML source
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)


Function _IEFormImageClick

Function Reference

_IEFormImageClick

Simulate a mouse click on an <input type=image>. Match by sub-string match of alt text, name or src.

#include <IE.au3>
_IEFormImageClick ( ByRef $o_object, $s_linkText [, $s_mode = "src" [, $i_index = 0 [, $f_wait = 1]]] )

Parameters

$o_object | Object variable of any DOM element (will be converted to the associated document object)
$s_linkText | Value used to match element - treatment based on $s_mode
$s_mode | Optional: specifies search mode src = (Default) match the url of the image name = match the name of the image alt = match the alternate text of the image
$i_index | Optional: If the img text occurs more than once, specifies which instance you want by 0-based index
$f_wait | Optional: specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 7 ($_IEStatus_NoMatch) = No Match
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
@Extended: | Contains invalid parameter number

Remarks

The <input type=image> form element is handled differently from all others. It is not recognized by Internet Explorer as a member of the form element collection and this function therefore gives you other means of getting a reference to it within the document using src, name or alt strings. Regardless of the object passed to this function, it looks for the form element within the full document context.

Related

_IEImgClick

Example

; *******************************************************
; Example 1 - Open a browser with the form example, click on the
; <input type=image> form element with matching alt text
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
_IEFormImageClick ($oIE, "AutoIt Homepage", "alt")

; *******************************************************
; Example 2 - Open a browser with the form example, click on the <input type=image>
; form element with matching img source URL (sub-string)
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
_IEFormImageClick ($oIE, "autoit_6_240x100.jpg", "src")

; *******************************************************
; Example 3 - Open a browser with the form example, click on the
; <input type=image> form element with matching name
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
_IEFormImageClick ($oIE, "imageExample", "name")


Function _IEFormReset

Function Reference

_IEFormReset

Reset a specified Form.

#include <IE.au3>
_IEFormReset ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application, Form object

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_IEFormSubmit, _IEFormGetObjByName, _IEFormGetCollection

Example

; *******************************************************
; Example 1 - Open a browser with the form example, fill in a form field and
; reset the form back to default values
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oText = _IEFormElementGetObjByName ($oForm, "textExample")
_IEFormElementSetValue ($oText, "Hey! It works!")
_IEFormReset ($oForm)


Function _IEFormSubmit

Function Reference

_IEFormSubmit

Submit a specified Form.

#include <IE.au3>
_IEFormSubmit ( ByRef $o_object [, $f_wait = 1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Form object
$f_wait | Optional: specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
@Extended: | Contains invalid parameter number

Remarks

For many HTML forms it is not sufficient to use _IEFormSubmit() because there is often custom JavaScript tied to an onClick event for its Submit button. In these cases you'll need to simulate a click of the submit button instead of using _IEFormSubmit(). See the example for the "click" action of _IEAction().

Related

_IEFormReset, _IEFormGetObjByName, _IEFormGetCollection, _IEFormElementGetObjByName, _IEFormElementGetCollection, _IELoadWait

Example

; *******************************************************
; Example 1 - Open a browser with the form example, fill in a form field and submit the form
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oText = _IEFormElementGetObjByName ($oForm, "textExample")
_IEFormElementSetValue ($oText, "Hey! It works!")
_IEFormSubmit ($oForm)

; *******************************************************
; Example 2 - Get a reference to a specific form element and set its value.
; In this case, submit a query to the Google search engine
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)


Function _IEFrameGetCollection

Function Reference

_IEFrameGetCollection

Returns a collection object containing the frames in a FrameSet or the iFrames on a normal page.

#include <IE.au3>
_IEFrameGetCollection ( ByRef $o_object [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$i_index | Optional: specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object variable containing the Frames collection, @EXTENDED = Frame count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_IEIsFrameSet

Example

; *******************************************************
; Example 1 - Open frameset example, get collection of frames
; and loop through them displaying their source URL's
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("frameset")
$oFrames = _IEFrameGetCollection ($oIE)
$iNumFrames = @extended
For $i = 0 to ($iNumFrames - 1)
$oFrame = _IEFrameGetCollection ($oIE, $i)
MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "locationurl"))
Next


Function _IEFrameGetObjByName

Function Reference

_IEFrameGetObjByName

Returns an object reference to a Frame by name.

#include <IE.au3>
_IEFrameGetObjByName ( ByRef $o_object, $s_name )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_name | Name of the Frame you wish to match

Return Value

Success: | Returns an object variable pointing to the Window object in a Frame, @EXTENDED = Frame count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

None.

Example

; *******************************************************
; Example 1 - Open iFrame example, get a reference to the iFrame
; with a name of "iFrameTwo" and replace its body HTML
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("iframe")
$oFrame = _IEFrameGetObjByName ($oIE, "iFrameTwo")
_IEBodyWriteHTML ($oFrame, "Hello <b>iFrame!</b>")
_IELoadWait ($oFrame)


Function _IEGetObjByName

Function Reference

_IEGetObjByName

Returns an object variable by name or id.

#include <IE.au3>
_IEGetObjByName ( ByRef $o_object, $s_Id [, $i_index = 0] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_Id | Specifies name or id of the object you wish to match
$i_index | Optional: If name of id occurs more than once, specifies instance by 0-based index 0 (Default) or positive integer returns an indexed instance -1 returns a collection of the specified objects

Return Value

Success: | Returns an object variable pointing to the specified Object, @EXTENDED = specified object count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

This function will return an object reference to any object in the document with a specified name.

Related

None.

Example

; *******************************************************
; Example 1 - Open a browser to the form example, get an object reference
; to the element with the name "ExampleForm". In this case the
; result is identical to using $oForm = _IEFormGetObjByName($oIE, "ExampleForm")
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEGetObjByName ($oIE, "ExampleForm")


Function _IEHeadInsertEventScript

Function Reference

_IEHeadInsertEventScript

Inserts a Javascript into the Head of the document.

#include <IE.au3>
_IEHeadInsertEventScript ( ByRef $o_object, $s_htmlFor, $s_event, $s_script )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_htmlFor | The HTML element for event monitoring (e.g. "document" or an element ID)
$s_event | The event to monitor (e.g. "onclick" or "oncontextmenu")
$s_script | Javascript string to be executed

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
@Extended: | Contains invalid parameter number

Remarks

Using ObjEvent, AutoIt is able to be notified of events via COM, but it manages them asynchronously rather than synchronously as they are handled in the browser context. This routine allows you to inject code that is managed inside the browser context.

Related

None.

Example

; *******************************************************
; Example 1 - Open a browser with the basic example page, insert an
; event script into the head of the document that creates
; a JavaScript alert when someone clicks on the document
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEHeadInsertEventScript ($oIE, "document", "onclick", "alert('Someone clicked the document!');")

; *******************************************************
; Example 2 - Open a browser with the basic example page, insert an
; event script into the head of the document that creates
; a JavaScript alert when someone tries to right-click on the
; document and then the event script returns "false" to prevent
; the right-click context menu from appearing
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEHeadInsertEventScript ($oIE, "document", "oncontextmenu", "alert('No Context Menu');return false")


Function _IEImgClick

Function Reference

_IEImgClick

Simulate a mouse click on an image. Match by sub-string match of alt text, name, or src.

#include <IE.au3>
_IEImgClick ( ByRef $o_object, $s_linkText [, $s_mode = "src" [, $i_index = 0 [, $f_wait = 1]]] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_linkText | Text to match the content of the attribute specified in $s_mode
$s_mode | Optional: specifies search mode src = (Default) match the url of the image name = match the name of the image alt = match the alternate text of the image
$i_index | Optional: If the img text occurs more than once, specify which instance you want by 0-based index
$f_wait | Optional: specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 7 ($_IEStatus_NoMatch) = No Match
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_IEImgGetCollection, _IEFormImageClick

Example

; *******************************************************
; Example 1 - Click on IMG by Alt text
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEImgClick ($oIE, "AutoIt Homepage Image", "alt")

; *******************************************************
; Example 2 - Click on IMG by name
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEImgClick ($oIE, "AutoItImage", "name")

; *******************************************************
; Example 3 - Click on IMG by src sub-string
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEImgClick ($oIE, "autoit_6_240x100.jpg", "src")

; *******************************************************
; Example 4 - Click on IMG by full src string
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEImgClick ($oIE, "http://www.autoitscript.com/images/autoit_6_240x100.jpg")


Function _IEImgGetCollection

Function Reference

_IEImgGetCollection

Returns a collection object variable representing the IMG tags in the document.

#include <IE.au3>
_IEImgGetCollection ( ByRef $o_object [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window, Frame or iFrame object
$i_index | Optional: specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object variable with a collection of all IMG tags in the document, @EXTENDED = img count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

None.

Example

; *******************************************************
; Example 1 - Create browser at AutoIt homepage, get a reference to
; the 6th Image on the page (note: the first image is index 0)
; and display information about it
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com/")
$oImg = _IEImgGetCollection ($oIE, 5)
$sInfo = "Src: " & $oImg.src & @CR
$sInfo &= "FileName: " & $oImg.nameProp & @CR
$sInfo &= "Height: " & $oImg.height & @CR
$sInfo &= "Width: " & $oImg.width & @CR
$sInfo &= "Border: " & $oImg.border
MsgBox(0, "4th Image Info", $sInfo)

; *******************************************************
; Example 2 - Create browser at AutoIt homepage, get Img collection
; and display src URL for each
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com/")
$oImgs = _IEImgGetCollection ($oIE)
$iNumImg = @extended
MsgBox(0, "Img Info", "There are " & $iNumImg & " images on the page")
For $oImg In $oImgs
MsgBox(0, "Img Info", "src=" & $oImg.src)
Next


Function _IEIsFrameSet

Function Reference

_IEIsFrameSet

Checks to see if the specified Window contains a FrameSet.

#include <IE.au3>
_IEIsFrameSet ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application, Window or Frame object

Return Value

Success: | Returns 1 if the object references a FrameSet page
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_IEFrameGetCollection

Example

; *******************************************************
; Example 1 - Display the frameset example, get frame collection,
; check number of frames, display number of frames or iFrames present
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("frameset")
$oFrames = _IEFrameGetCollection ($oIE)
$iNumFrames = @extended
If $iNumFrames > 0 Then
If _IEIsFrameSet ($oIE) Then
MsgBox(0, "Frame Info", "Page contains " & $iNumFrames & " frames in a FrameSet")
Else
MsgBox(0, "Frame Info", "Page contains " & $iNumFrames & " iFrames")
EndIf
Else
MsgBox(0, "Frame Info", "Page contains no frames")
EndIf


Function _IELinkClickByIndex

Function Reference

_IELinkClickByIndex

Simulate a mouse click on a link by 0-based index (in source order).

#include <IE.au3>
_IELinkClickByIndex ( ByRef $o_object, $i_index [, $f_wait = 1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$i_index | Optional: 0-based index of the link you wish to match
$f_wait | Optional: specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 7 ($_IEStatus_NoMatch) = No Match
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_IELinkClickByText

Example

; *******************************************************
; Example 1 - Open browser with basic example, click on the 3rd
; link on the page (note: the first link is index 0)
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IELinkClickByIndex ($oIE, 2)


Function _IELinkClickByText

Function Reference

_IELinkClickByText

Simulate a mouse click on a link with text sub-string matching the string provided.

#include <IE.au3>
_IELinkClickByText ( ByRef $o_object, $s_linkText [, $i_index = 0], $f_wait = 1]] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_linkText | Text displayed on the web page for the desired link to click
$i_index | Optional: If the link text occurs more than once, specify which instance you want by 0-based index
$f_wait | Optional: specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 7 ($_IEStatus_NoMatch) = No Match
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_IELinkClickByIndex

Example

; *******************************************************
; Example 1 - Open browser with basic example, click on the link
; with text "user forum"
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IELinkClickByText ($oIE, "user forum")


Function _IELinkGetCollection

Function Reference

_IELinkGetCollection

Returns a collection object containing all links in the document.

#include <IE.au3>
_IELinkGetCollection ( ByRef $o_object [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$i_index | Optional: specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object collection of all links in the document, @EXTENDED = link count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

None.

Example

; *******************************************************
; Example 1 - Open browser with basic example, get link collection,
; loop through items and display the associated link URL references
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
$oLinks = _IELinkGetCollection ($oIE)
$iNumLinks = @extended
MsgBox(0, "Link Info", $iNumLinks & " links found")
For $oLink In $oLinks
MsgBox(0, "Link Info", $oLink.href)
Next


Function _IELoadWait

Function Reference

_IELoadWait

Wait for a browser page load to complete before returning.

#include <IE.au3>
_IELoadWait ( ByRef $o_object [, $i_delay = 0 [, $i_timeout = -1]] )

Parameters

$o_object | Object variable of an InternetExplorer.Application
$i_delay | Optional: Milliseconds to wait before checking status
$i_timeout | Optional: Period of time to wait before exiting function (default = 300000 ms aka 5 min)

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
@Extended: | Contains invalid parameter number

Remarks

Several IE.au3 functions call _IELoadWait() automatically (e.g. _IECreate(), _IENavigate() etc.). Most functions that do this also allow you to turn this off with a $f_wait parameter if you do not want the wait or if you want to call it yourself.

Browser scripting security restrictions may sometimes prevent _IELoadWait from guaranteeing that a page is fully loaded and can occasionally result in untrapped errors. In these cases you may need to avoid calling _IELoadWait and attempt to employ other methods of insuring that the page load has completed. These methods might include using a Sleep command, examining browser status bar text and other methods. When using functions that call _IELoadWait for objects other than the InternetExplorer (browser) object, you may also be successful by calling _IELoadWait for the browser yourself (e.g. _IELoadWait($oIE)).

The most common causes of trouble are page redirects and cross-site scripting security restrictions associated with frames. Page re-writing techniques employed by some applications (e.g. Gmail) can also cause trouble here.

Related

_IELoadWaitTimeout, _IECreate, _IENavigate, _IEFormSubmit, _IELinkClickByText, _IELinkClickByIndex, _IEImgClick, _IEFormImageClick, _IEBodyWriteHTML, _IEDocWriteHTML, _IEAction

Example

; *******************************************************
; Example 1 - Open the AutoIt forum page, tab to the "View new posts"
; link and activate the link with the enter key.
; Then wait for the page load to complete before moving on.
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com/forum/index.php")
Send("{TAB 12}")
Send("{ENTER}")
_IELoadWait ($oIE)


Function _IELoadWaitTimeout

Function Reference

_IELoadWaitTimeout

Retrieve or set the current value in milliseconds _IELoadWait will try before timing out.

#include <IE.au3>
_IELoadWaitTimeout ( [$i_timeout = -1] )

Parameters

$i_timeout Optional: retrieve or specify the number of milliseconds
0 or positive integer sets timeout to this value
-1 = (Default) returns the current timeout value (stored in global variable $__IELoadWaitTimeout)

Return Value

Success: | If $i_timeout = -1, returns the current timeout value, else returns 1
Failure: | None

Remarks

There is no way to completely disable the Timeout value. You can functionally do this however by setting it to a very large positive integer.

Related

_IELoadWait

Example

; *******************************************************
; Example 1 - Obtain current timeout value
; *******************************************************
;
#include <IE.au3>
$iCurrentTimeout = _IELoadWaitTimeout ()

; *******************************************************
; Example 2 - Set timeout to 1 minute (60000 milliseconds)
; *******************************************************
;
#include <IE.au3>
_IELoadWaitTimeout (60000)


Function _IENavigate

Function Reference

_IENavigate

Directs an existing browser window to navigate to the specified URL.

#include <IE.au3>
_IENavigate ( ByRef $o_object, $s_url [, $f_wait = 1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_url | URL to navigate to (e.g. "http://www.autoitscript.com")
$f_wait | Optional: specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
@Extended: | Contains invalid parameter number

Remarks

This function always returns a value of -1. This is because the navigate method has no return value and therefore nothing can be implied from it. You will need to employ other methods to determine success or failure of the navigation.

Related

_IECreate

Example

; *******************************************************
; Example 1 - Create a browser window and navigate to a website,
; wait 5 seconds and navigate to another
; wait 5 seconds and navigate to another
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("www.autoitscript.com")
Sleep(5000)
_IENavigate ($oIE, "http://www.autoitscript.com/forum/index.php?")
Sleep(5000)
_IENavigate ($oIE, "http://www.autoitscript.com/forum/index.php?showforum=9")

; *******************************************************
; Example 2 - Create a browser window and navigate to a website,
; do not wait for page load to complete before moving to next line
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("www.autoitscript.com", 0)
MsgBox(0, "_IENavigate()", "This code executes immediately")


Function _IEPropertyGet

Function Reference

_IEPropertyGet

Returns a select property of the Browser.

#include <IE.au3>
_IEPropertyGet ( ByRef $o_object, $s_property )

Parameters

$o_object | Object variable of an InternetExplorer.Application
$s_property | Property selection (see remarks)

Return Value

Success: | Value of selected Property
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

Further information can be found at MSDN.

The following tables provide a description of each property available for use.

Browser Properties

Property | Description
"addressbar" | Retrieves whether the address bar of the object is visible or hidden.
"busy" | Retrieves a Boolean value indicating whether the object is engaged in a navigation or downloading operation.
"fullscreen" | Retrieves a Boolean value that indicates whether Microsoft Internet Explorer is in full-screen or normal window mode.
"height" | Retrieves the height of the Internet Explorer main window.
"hwnd" | Retrieves the handle of the Internet Explorer main window.
"isdisabled" | Retrieves the value indicating whether the user can interact with the object.
"left" | Retrieves the screen coordinate of the left edge of the main window of the object.
"locationname" | Retrieves the name of the resource that Internet Explorer is currently displaying.
"locationurl" | Retrieves the URL of the resource that Internet Explorer is currently displaying.
"menubar" | Retrieves a Boolean value that indicates whether the Internet Explorer menu bar is visible.
"offline" | Retrieves a Boolean value that indicates whether the object is currently operating in offline mode.
"readystate" | Retrieves the ready state of the object.
"resizable" | Retrieves a value that indicates whether the object can be resized.
"silent" | Retrieves a value that indicates whether the object can show dialog boxes.
"statusbar" | Retrieves a value that indicates whether the status bar for the object is visible.
"statustext" | Retrieves the text in the status bar for the object.
"top" | Retrieves the screen coordinate of the top edge of the main window of the object.
"visible" | Retrieves a value that indicates whether the object is visible or hidden.
"width" | Retrieves the width of the main window for the object.

ClientInfo Properties

Property | Description
"appcodename" | Retrieves the code name of the browser (the property has a default value of Mozilla).
"appminorversion" | Retrieves the application's minor version value.
"appname" | Retrieves the name of the browser (the property has a default value of Microsoft Internet Explorer).
"appversion" | Retrieves the platform and version of the browser.
"browserlanguage" | Retrieves the current browser language (the value will be one of these Language Codes).
"cookieenabled" | Retrieves whether client-side persistent cookies are enabled in the browser. Persistent cookies are those that are stored on the client-side computer.
"cpuclass" | Retrieves a string denoting the CPU class (the return values can be found here).
"javaenabled" | Returns whether Java is enabled.
"online" | Retrieves a value indicating whether the system is in global offline mode.
"platform" | Retrieves the name of the user's operating system (the return values can be found here).
"systemlanguage" | Retrieves the default language used by the operating system (the value will be one of these Language Codes).
"useragent" | Retrieves a string equivalent to the HTTP user-agent request header.
"userlanguage" | Retrieves the operating system's natural language setting (the value will be one of these Language Codes).
"vcard" | Returns an array containing each attribute in the userProfile object (a list of attributes can be found here). The return is a two dimentional array, where the first dimention has two elements. The first element (0) contains the attribute names, the second element (1) contains the corresponding values. The second dimention has 29 elements (0 to 28).

Related

_IEPropertySet

Example

; *******************************************************
; Example 1 - Open a browser with the basic example, check to see if the
; addressbar is visible, if it is turn it off, if it is not turn it on
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
If _IEPropertyGet ($oIE, "addressbar") Then
MsgBox(0, "AddressBar Status", "AddressBar Visible, turning it off")
_IEPropertySet ($oIE, "addressbar", False)
Else
MsgBox(0, "AddressBar Status", "AddressBar Invisible, turning it on")
_IEPropertySet ($oIE, "addressbar", True)
EndIf


Function _IEPropertySet

Function Reference

_IEPropertySet

Set a select property of the Browser.

#include <IE.au3>
_IEPropertySet ( ByRef $o_object, $s_property, $newvalue )

Parameters

$o_object | Object variable of an InternetExplorer.Application
$s_property | Property selection (see remarks)
$newvalue | The new value to be set into the Browser Property

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

Further information can be found at MSDN.

The following table provide a description of each property available for use.

Browser Properties

Property | Description
"addressbar" | Specifies whether the address bar of the object is visible or hidden.
"height" | Specifies the height of the Internet Explorer main window.
"left" | Specifies the screen coordinate of the left edge of the main window of the object.
"locationname" | Specifies the name of the resource that Internet Explorer is currently displaying.
"locationurl" | Specifies the URL of the resource that Internet Explorer is currently displaying.
"menubar" | Specifies a Boolean value that indicates whether the Internet Explorer menu bar is visible.
"offline" | Specifies a Boolean value that indicates whether the object is currently operating in offline mode.
"resizable" | Specifies a value that indicates whether the object can be resized.
"statusbar" | Specifies a value that indicates whether the status bar for the object is visible.
"statustext" | Specifies the text in the status bar for the object.
"top" | Specifies the screen coordinate of the top edge of the main window of the object.
"width" | Specifies the width of the main window for the object.

Related

_IEPropertyGet

Example

; *******************************************************
; Example 1 - Open a browser with the basic example, check to see if the
; addressbar is visible, if it is not turn it on. Then change
; the text displayed in the statusbar
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
If Not _IEPropertyGet ($oIE, "statusbar") Then _IEPropertySet ($oIE, "statusbar", True)
_IEPropertySet ($oIE, "statustext", "Look What I can Do")
Sleep(1000)
_IEPropertySet ($oIE, "statustext", "I can change the status text")


Function _IEQuit

Function Reference

_IEQuit

Close the browser and remove the object reference to it.

#include <IE.au3>
_IEQuit ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

_IEQuit is particularly important when creating or working with invisible instances of Internet Explorer. When AutoIt exits when working with visible instances of a browser, the browser continues to run and the visible window is left for the user to manage. When the browser instance is invisible however, when AutoIt exits the browser process is left running and there is no user interface to interact with and an orphan Iexplore.exe process is left running on the system. It is therefore good practice to call _IEQuit whenever the browser process is not needed after the script exists.

_IEQuit is not allowed with embedded browser objects created with _IECreateEmbedded. The browser processes associated with those objects will close when their parent GUI window is destroyed.

Related

_IEAttach, _IECreate

Example

; *******************************************************
; Example 1 - Create an invisible browser window, navigate to a
; website, retrieve some information and Quit
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://sourceforge.net", 0, 0)
; Display the innerText on an element on the page with a name of "sfmarquee"
$oMarquee = _IEGetObjByName ($oIE, "sfmarquee")
MsgBox(0, "SourceForge Information", $oMarquee.innerText)
_IEQuit ($oIE)


Function _IETableGetCollection

Function Reference

_IETableGetCollection

Returns a collection object variable representing all the tables in a document.

#include <IE.au3>
_IETableGetCollection ( ByRef $o_object [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$i_index | Optional: specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object collection of all tables in the document, @EXTENDED = table count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

None.

Example

; *******************************************************
; Example 1 - Open a browser with the table example, get a reference to the first table
; on the page (index 0) and read its contents into a 2-D array
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("table")
$oTable = _IETableGetCollection ($oIE, 0)
$aTableData = _IETableWriteToArray ($oTable)

; *******************************************************
; Example 2 - Open a browser with the table example, get a reference to the
; table collection and display the number of tables on the page
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("table")
$oTable = _IETableGetCollection ($oIE)
$iNumTables = @extended
MsgBox(0, "Table Info", "There are " & $iNumTables & " tables on the page")


Function _IETableWriteToArray

Function Reference

_IETableWriteToArray

Reads the contents of a Table into an array.

#include <IE.au3>
_IETableWriteToArray ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application, Table object

Return Value

Success: | Returns a 2-dimensional array containing the contents of the Table
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

When table cells span multiple columns or rows, blank array elements are added to properly align the results. Data in spanning cells will be in the left or uppermost array elements.

Related

None.

Example

; *******************************************************
; Example 1 - Open a browser with the table example, get a reference to the second table
; on the page (index 1) and read its contents into a 2-D array
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("table")
$oTable = _IETableGetCollection ($oIE, 1)
$aTableData = _IETableWriteToArray ($oTable)


Function _IETagNameAllGetCollection

Function Reference

_IETagNameAllGetCollection

Returns a collection object all elements in the document or document hierarchy in source order.

#include <IE.au3>
_IETagNameAllGetCollection ( ByRef $o_object [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window, Frame, iFrame or any object in the DOM
$i_index | Optional: specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object variable containing the Tag collection, @EXTENDED = Tag count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

The DOM is hierarchical, so if the object passed is the document object, all elements in the document are returned. If the object passed in is an object inside the document (e.g. a TABLE object), then only the elements inside that object are returned.

Related

_IETagNameGetCollection

Example

; *******************************************************
; Example 1 - Open a browser with the basic example, get the collection
; of all elements and display the tagname and innerText of each
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
$oElements = _IETagNameAllGetCollection ($oIE)
For $oElement In $oElements
MsgBox(0, "Element Info", "Tagname: " & $oElement.tagname & @CR & "innerText: " & $oElement.innerText)
Next


Function _IETagNameGetCollection

Function Reference

_IETagNameGetCollection

Returns a collection object of all elements in the object with the specified TagName.

#include <IE.au3>
_IETagNameGetCollection ( ByRef $o_object, $s_TagName [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window, Frame, iFrame or any object in the DOM
$s_TagName | TagName of collection to return (e.g. IMG, TR etc.)
$i_index | Optional: specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object variable containing the specified Tag collection, @EXTENDED = specified Tag count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

The DOM is hierarchical, so if the object passed is the document object, the specified elements in the document are returned. If the object passed is an object inside the document (e.g. a TABLE object), then only the specified elements inside that object are returned.

Related

_IETagNameAllGetCollection

Example

; *******************************************************
; Example 1 - Open a browser with the form example, get the collection
; of all INPUT tags and display the formname and type of each
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oInputs = _IETagNameGetCollection ($oIE, "input")
For $oInput In $oInputs
MsgBox(0, "Form Input Type", "Form: " & $oInput.form.name & " Type: " & $oInput.type)
Next


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: Inet Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_GetIP | Get public IP address of a network/computer.
_INetExplorerCapable | Converts a string to IE(Internet Explorer) capable line
_INetGetSource | Gets the source from an URL without writing a temp file.
_INetMail | Opens default user's mail client with given address, subject, and body.
_INetSmtpMail | Sends an email without using an external email program.


Function _GetIP

Function Reference

_GetIP

Get public IP address of a network/computer.

#include <INet.au3>
_GetIP()

Parameters

None

Return Value

Success: | Returns the public IP Address
Failure: | Returns -1 and sets @ERROR = 1

Remarks

This only returns the Public IP address of a computer or network.

Related

None.

Example

#include <Inet.au3>
$PublicIP = _GetIP()
MsgBox(0, "IP Address", "Your IP Address is: " & $PublicIP)


Function _INetExplorerCapable

Function Reference

_INetExplorerCapable

Converts a string to IE(Internet Explorer) capable line

#include <INet.au3>
_INetExplorerCapable ( $s_IEString )

Parameters

$s_IEString String to be converted

Return Value

Success: | Converted string
Failure: | Blank string and @error = 1

Remarks

This converts IE uncapable characters to '%' and their hex value

Related

None.

Example

#include <INet.au3>

MsgBox(0, "", _INetExplorerCapable(InputBox("", "Enter a string to convert into browser readable text")))


Function _INetGetSource

Function Reference

_INetGetSource

Gets the source from an URL without writing a temp file.

#include <INet.au3>
_INetGetSource ( $s_URL )

Parameters

$s_URL (The URL of the site.) eg 'www.autoitscript.com'

Return Value

Success: | Returns the source code.
Failure: | 0 and sets @ERROR = 1

Remarks

None.

Related

INetGet

Example

#include <INet.au3>
ConsoleWrite(_INetGetSource('www.autoitscript.com'))


Function _INetMail

Function Reference

_INetMail

Opens default user's mail client with given address, subject, and body.

#include <INet.au3>
_INetMail ( $s_MailTo, $s_MailSubject, $s_MailBody )

Parameters

$s_MailTo | Address for the E-Mail
$s_MailSubject | Subject for the E-Mail
$s_MailBody | Body for the E-Mail

Return Value

Success: | Process identifier for the E-Mail client
Failure: | See remarks.

Remarks

If this fails to find the correct mail client the script will depend on the status of Opt('RunErrorsFatal', *)
Failure and Opt('RunErrorsFatal',1) will crash script
Failure and Opt('RunErrorsFatal',0) will return blank string and @error = 1

It is recomended before using this function to set Opt('RunErrorsFatal', 0)!

Related

None.

Example

#include <INet.au3>

$Address = InputBox('Address', 'Enter the E-Mail address to send message to')
$Subject = InputBox('Subject', 'Enter a subject for the E-Mail')
$Body = InputBox('Body', 'Enter the body (message) of the E-Mail')
MsgBox(0,'E-Mail has been opened','The E-Mail has been opened and process identifier for the E-Mail client is ' & _INetMail($address, $subject, $body))


Function _INetSmtpMail

Function Reference

_INetSmtpMail

Sends an email without using an external email program.

#include <INet.au3>
_INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress [,$s_Subject [,$as_Body [,$s_helo, [,$s_first [,$b_trace]]]]])

Parameters

$s_SmtpServer | Smtp server the eMail is to be sent though May be either alpha or a numeric IP address. In order to fight spam, many ISPs require this to be their server. eg "smtp.ispdomain.com", "mail.ispdomain.com" or "192.168.1.1"
$s_FromName | The name you wish the message to appear to be sent from. eg "Bob Smith"
$s_FromAddress | The email address you wish the message to appear to be sent from. eg "bob.smith@mydomain.com".
$s_ToAddress | The email address the message is to go to. eg "jane.brown@yourdomain.com"
$s_Subject | [optional] The subject of the email.
$as_Body | [optional] The body of the email as a single dimensional array of strings. Each value in the array will be terminated with a @CRLF in the email.
$s_helo | [optional] identifier for the smtp server connection (by default @ComputerName). If Smtp server require a "EHLO" string just set the string to "EHLO " & @ComputerName.
$s_first | [optional] string sent before helo for the smtp server connection (by default @CRLF).
$b_trace | [optional] trace the dialog in a splash window

Return Value

On Success - Returns 1
On Failure - Returns 0 and sets:
@ERROR = 1 - Invalid Parameters
@ERROR = 2 - Unable to start TCP
@ERROR = 3 - Unable to resolve IP
@ERROR = 4 - Unable to create socket
@ERROR = 5x - Cannot open SMTP session. x indicates the index number of last command issued to the SMTP server.
@ERROR = 50x - Cannot send body. x indicates the line number of $as_Body (first line is 0).
@ERROR = 5000 - Cannot close SMTP session

Remarks

This function sends a email directly through an SMTP server without the use of a third party email client. Requires AutoIt3 v 3.1.1.97 or better.

Related

_INetMail

Example

#include <INet.au3>

$s_SmtpServer = "mysmtpserver.com.au"
$s_FromName = "My Name"
$s_FromAddress = "From eMail Address"
$s_ToAddress = "To eMail Address"
$s_Subject = "My Test UDF"
Dim $as_Body[2]
$as_Body[0] = "Testing the new email udf"
$as_Body[1] = "Second Line"
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
$err = @error
If $Response = 1 Then
MsgBox(0, "Success!", "Mail sent")
Else
MsgBox(0, "Error!", "Mail failed with error code " & $err)
EndIf


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: Math Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_Degree | Converts radians to degrees.
_MathCheckDiv | Checks if NumA is divisable by NumB
_Max | Evaluates which of the two numbers is higher.
_Min | Evaluates which of the two numbers is lower.
_Radian | Converts degrees to radians.


Function _Degree

Function Reference

_Degree

Converts radians to degrees.

#include <Math.au3>
_Degree ( $nRadians )

Parameters

$nRadians Radians to be converted into degrees.

Return Value

Success: | Degrees converted from radians.
Failure: | Blank string and @error set to 1.

Remarks

Can be used in conjunction with the Sin(), Cos(), and Tan() functions.

Related

_Radian, Sin, Cos, Tan, ASin, ACos, ATan

Example

#include <Math.au3>

$radians = 3.14159265358979
$degrees = _Degree($radians)

MsgBox(0, "Radians to Degrees", $radians & " radians = " & $degrees & " degrees")


Function _MathCheckDiv

Function Reference

_MathCheckDiv

Checks if NumA is divisable by NumB

#include <Math.au3>
_MathCheckDiv ( $i_NumA, $i_NumB )

Parameters

$i_NumA | Number to check
$i_NumB | Number to divide by

Return Value

Success: | Returns 1 for not divisable,
 | 2 for divisable.
Failure: | Returns -1 and @error = 1 if not valid numbers.

Remarks

This function will also enable checking if a number is even/odd by making the second parameter = 2

Related

None.

Example

#include <math.au3>
$I_Var = InputBox('Odd or Even', 'Enter a number:')
$I_Result = _MathCheckDiv($I_Var, 2)
If $I_Result = -1 Or @error = 1 Then
MsgBox(0,'','You did not enter a valid number')
ElseIf $I_Result = 1 Then
MsgBox(0,'','Number is odd')
ElseIf $I_Result = 2 Then
MsgBox(0,'','Number is even')
Else
MsgBox(0,'','Could not parse $I_Result')
EndIf


Function _Max

Function Reference

_Max

Evaluates which of the two numbers is higher.

#include <Math.au3>
_Max ( $nNum1, $nNum2 )

Parameters

$nNum1 | First number.
$nNum2 | Second number.

Return Value

Success: | Returns the higher of the two numbers.
Failure: | Returns 0.
@Error: | 0 = No error.
 | 1 = $nNum1 isn't a number.
 | 2 = $nNum2 isn't a number.

Remarks

This function works with floats as well as integers.

Related

_Min

Example

#include <Math.au3>

$x = _Max(25, 10) ; returns 25


Function _Min

Function Reference

_Min

Evaluates which of the two numbers is lower.

#include <Math.au3>
_Min ( $nNum1, $nNum2 )

Parameters

$nNum1 | First number.
$nNum2 | Second number.

Return Value

Success: | Returns the lower of the two numbers.
Failure: | Returns 0.
@Error: | 0 = No error.
 | 1 = $nNum1 isn't a number.
 | 2 = $nNum2 isn't a number.

Remarks

This function works with floats as well as integers.

Related

_Max

Example

#include <Math.au3>

$x = _Min(25, 10) ; returns 10


Function _Radian

Function Reference

_Radian

Converts degrees to radians.

#include <Math.au3>
_Radian ( $nDegrees )

Parameters

$aDegrees Degrees to be converted into radians.

Return Value

Success: | Radians converted from degrees.
Failure: | Blank string and @error set to 1

Remarks

Can be used in conjunction with the Sin(), Cos(), and Tan() functions.

Related

_Degree, Sin, Cos, Tan, ASin, ACos, ATan

Example

#include <Math.au3>

$degrees = 35
$radians = _Radian($degrees)

MsgBox(0, "Degrees to Radians", $degrees & " degrees = " & $radians & " radians")


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: Misc Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_ChooseColor | Creates a Color dialog box that enables the user to select a color.
_ChooseFont | Creates a Font dialog box that enables the user to choose attributes for a logical font.
_ClipPutFile | Copy Files to Clipboard Like Explorer does
_Iif | Perform a boolean test within an expression.
_IsPressed | Check if key has been pressed
_MouseTrap | Confine the Mouse Cursor to specified coords.
_Singleton | Check if no other occurrence is running.


Function _ChooseColor

Function Reference

_ChooseColor

Creates a Color dialog box that enables the user to select a color.

#include <Misc.au3>
_ChooseColor([$i_ReturnType = 0[, $i_colorref = 0[, $i_refType=0]]])

Parameters

$i_ReturnType | Optional: determines return type
$i_colorref | Optional: default selected Color
$i_refType | Optional: Type of $i_colorref passed in

Return Value

Returns COLORREF rgbcolor if $i_refType = 0 (default)
Returns Hex BGR value if $i_refType = 1
Returns Hex RGB Color if $i_refType = 2
if error occurs, @error is set

Remarks

$i_ReturnType = 0 then COLORREF rgbcolor is returned (default)
$i_ReturnType = 1 then Hex BGR Color is returned
$i_ReturnType = 2 Hex RGB Color is returned

$i_colorref = 0 (default)

$i_refType = 0 then $i_colorref is COLORREF rgbcolor value (default)
$i_refType = 1 then $i_colorref is BGR hex value
$i_refType = 2 then $i_colorref is RGB hex value

Related

None.

Example

#include <Misc.au3>

Local $color

$color = _ChooseColor (0)
If (@error) Then
MsgBox(0, "", "Error _ChooseColor: " & @error)
Else
MsgBox(0,"_ChooseColor","COLORREF rgbColors: " & $color)
EndIf

$color = _ChooseColor (1)
If (@error) Then
MsgBox(0, "", "Error _ChooseColor: " & @error)
Else
MsgBox(0,"_ChooseColor","Hex BGR Color: " & $color)
EndIf

$color = _ChooseColor (2, 255) ; default color selected using COLORREF rgbcolor
If (@error) Then
MsgBox(0, "", "Error _ChooseColor: " & @error)
Else
MsgBox(0,"_ChooseColor","Hex RGB Color: " & $color)
EndIf

$color = _ChooseColor (2, 0x0000FF, 1) ; default color selected using BGR hex value
If (@error) Then
MsgBox(0, "", "Error _ChooseColor: " & @error)
Else
MsgBox(0,"_ChooseColor","Hex RGB Color: " & $color)
EndIf

$color = _ChooseColor (2, 0xFF0000, 2) ; default color selected using RGB hex value
If (@error) Then
MsgBox(0, "", "Error _ChooseColor: " & @error)
Else
MsgBox(0,"_ChooseColor","Hex RGB Color: " & $color)
EndIf


Function _ChooseFont

Function Reference

_ChooseFont

Creates a Font dialog box that enables the user to choose attributes for a logical font.

#include <Misc.au3>
_ChooseFont([$s_FontName = "Courier New"[, $i_size = 10[, $i_colorref = 0]]])

Parameters

$s_FontName | Optional: Default font name
$i_size | Optional: pointsize of font
$i_colorref | Optional: COLORREF rgbColors

Return Value

Returns Array, $array[0] contains the number of elements
if error occurs, @error is set

Remarks

$array[1] - attributes = BitOr of italic:2, undeline:4, strikeout:8
$array[2] - fontname
$array[3] - font size = point size
$array[4] - font weight = = 0-1000
$array[5] - COLORREF rgbColors
$array[6] - Hex BGR Color
$array[7] - Hex RGB Color

Related

None.

Example

#include <Misc.au3>

Local $a_font

$a_font = _ChooseFont ("Arial",8)
If (@error) Then
MsgBox(0, "", "Error _ChooseFont: " & @error)
Else
MsgBox(0, "", "Font Name: " & $a_font[2] & @LF & "Size: " & $a_font[3] & @LF & "Weight: " & $a_font[4] & @LF & "COLORREF rgbColors: " & $a_font[5] & @LF & "Hex BGR Color: " & $a_font[6] & @LF & "Hex RGB Color: " & $a_font[7])
EndIf

$a_font = _ChooseFont ()
If (@error) Then
MsgBox(0, "", "Error _ChooseFont: " & @error)
Else
MsgBox(0, "", "Font Name: " & $a_font[2] & @LF & "Size: " & $a_font[3] & @LF & "Weight: " & $a_font[4] & @LF & "COLORREF rgbColors: " & $a_font[5] & @LF & "Hex BGR Color: " & $a_font[6] & @LF & "Hex RGB Color: " & $a_font[7])
EndIf


Function _ClipPutFile

Function Reference

_ClipPutFile

Copy Files to Clipboard Like Explorer does

#include <Misc.au3>
_ClipPutFile($sFile [, $sSeperator])

Parameters

$sFile | Full Path to File(s)
$sSeperator | Seperator for multiple Files, Default = '|'

Return Value

Success: | True
Failure: | False
@ERROR: | 1 - Unable to Open Clipboard
 | 2 - Unable to Empty Cipboard
 | 3 - GlobalAlloc Failed
 | 4 - GlobalLock Failed
 | 5 - Unable to Create H_DROP
 | 6 - Unable to Update Clipboard
 | 7 - Unable to Close Clipboard
 | 8 - GlobalUnlock Failed

Remarks

To Retrive a list of Files stored in the Clipboard use ClipGet().

Related

ClipGet, ClipPut

Example

#include "misc.au3"
Local $fTest
$fTest = _ClipPutFile(@ScriptFullPath)
If Not $fTest Then
MsgBox(0,"_ClipPutFile() call Failed","@error = " & @error)
Else
MsgBox(0,"_ClipPutFile()","Content of Clipboard:" & ClipGet())
EndIf


Function _Iif

Function Reference

_Iif

Perform a boolean test within an expression.

#include <Misc.au3>
_Iif ( $f_Test, $v_TrueVal, $v_FalseVal )

Parameters

$f_Test | Boolean test.
$v_TrueVal | Value to return if $f_Test is true.
$v_FalseVal | Value to return if $f_Test is false.

Return Value

One of $v_TrueVal or $v_FalseVal.

Remarks

Note that all parameters are evaluated, even though only one is returned.

Related

None.

Example

#include <Misc.au3>

Dim $i_Count, $i_Index

For $i_Index = 1 To 2
MsgBox(4096, "Count", "This dialog has displayed " & String($i_Index) & _
" time" & _Iif($i_Index > 1, "s", "") & " so far")
Next

Exit


Function _IsPressed

Function Reference

_IsPressed

Check if key has been pressed

#Include <Misc.au3>
_IsPressed($s_hexKey[, $v_dll = 'user32.dll'])

Parameters

$s_hexKey | key to check for
$v_dll | Optional: Handle to dll or default to user32.dll

Return Value

Success: | Returns 1 if true.
Failure: | Returns 0 if false.

Remarks

01 Left mouse button
02 Right mouse button
04 Middle mouse button (three-button mouse)
05 Windows 2000/XP: X1 mouse button
06 Windows 2000/XP: X2 mouse button
08 BACKSPACE key
09 TAB key
0C CLEAR key
0D ENTER key
10 SHIFT key
11 CTRL key
12 ALT key
13 PAUSE key
14 CAPS LOCK key
1B ESC key
20 SPACEBAR
21 PAGE UP key
22 PAGE DOWN key
23 END key
24 HOME key
25 LEFT ARROW key
26 UP ARROW key
27 RIGHT ARROW key
28 DOWN ARROW key
29 SELECT key
2A PRINT key
2B EXECUTE key
2C PRINT SCREEN key
2D INS key
2E DEL key
30 0 key
31 1 key
32 2 key
33 3 key
34 4 key
35 5 key
36 6 key
37 7 key
38 8 key
39 9 key
41 A key
42 B key
43 C key
44 D key
45 E key
46 F key
47 G key
48 H key
49 I key
4A J key
4B K key
4C L key
4D M key
4E N key
4F O key
50 P key
51 Q key
52 R key
53 S key
54 T key
55 U key
56 V key
57 W key
58 X key
59 Y key
5A Z key
5B Left Windows key
5C Right Windows key
60 Numeric keypad 0 key
61 Numeric keypad 1 key
62 Numeric keypad 2 key
63 Numeric keypad 3 key
64 Numeric keypad 4 key
65 Numeric keypad 5 key
66 Numeric keypad 6 key
67 Numeric keypad 7 key
68 Numeric keypad 8 key
69 Numeric keypad 9 key
6A Multiply key
6B Add key
6C Separator key
6D Subtract key
6E Decimal key
6F Divide key
70 F1 key
71 F2 key
72 F3 key
73 F4 key
74 F5 key
75 F6 key
76 F7 key
77 F8 key
78 F9 key
79 F10 key
7A F11 key
7B F12 key
7C-7F F13 key - F16 key
80H-87H F17 key - F24 key
90 NUM LOCK key
91 SCROLL LOCK key
A0 Left SHIFT key
A1 Right SHIFT key
A2 Left CONTROL key
A3 Right CONTROL key
A4 Left MENU key
A5 Right MENU key

Related

None.

Example

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
Sleep ( 250 )
If _IsPressed("23", $dll) Then
MsgBox(0,"_IsPressed", "End Key Pressed")
ExitLoop
EndIf
WEnd
DllClose($dll)


Function _MouseTrap

Function Reference

_MouseTrap

Confine the Mouse Cursor to specified coords.

#include <Misc.au3>
_MouseTrap([$i_left = 0[, $i_top = 0[, $i_right = 0[, $i_bottom = 0]]]])

Parameters

$i_left | Left coord
$i_top | Top coord
$i_right | Right coord
$i_bottom | Bottom coord

Return Value

Success: | Returns a non zero value
Failure: | Returns 0

Remarks

Use _MouseTrap() with no params to release the Mouse Cursor

Setting only $i_left and $i_top sets:
$i_right = $i_left
$i_bottom = $i_top

Related

None.

Example

#include <GuiConstants.au3>
#include <Misc.au3>

Opt ("MustDeclareVars", 1)

Dim $GUI, $coords[4], $msg

$GUI = GUICreate("Mouse Trap Example", 392, 323)

GUISetState()

While 1
$coords = WinGetPos($GUI)
_MouseTrap ($coords[0], $coords[1], $coords[0] + $coords[2], $coords[1] + $coords[3])
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;
EndSelect
WEnd
_MouseTrap ()
Exit


Function _Singleton

Function Reference

_Singleton

Check if no other occurrence is running.

#include <Misc.au3>
_Singleton($occurrenceName [,$flag=0 )))

Parameters

$occurrenceName | string to identify the occurrence of the script
$flag | when 1 the function return on error

Return Value

On Flag = 1 otherwise the script is exited
Success: | Returns 1
Failure: | Returns 0

Remarks

If an occurrence is already found the script is exited.

The second call to the function in the same running script will fail.

Related

None.

Example

#include "Misc.au3"
if _Singleton("test\test",1) = 0 Then
Msgbox(0,"Warning","An occurence of test is already running")
Exit
EndIf
Msgbox(0,"OK","the first occurence of test is running")


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: Process Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_ProcessGetName | Returns a string containing the process name that belongs to a given PID.
_ProcessGetPriority | Get the priority of an open process
_RunDOS | Executes a DOS command in a hidden command window.


Function _ProcessGetName

Function Reference

_ProcessGetName

Returns a string containing the process name that belongs to a given PID.

#include <Process.au3>
_ProcessGetName ( $iPID )

Parameters

$iPID The PID of a currently running process.

Return Value

Success: | Returns The name of the process.
Failure: | Returns Blank string and sets the @error to the following values:
 | @error = 1 : Process doesn't exist
 | @error = 2 : Error getting process list
 | @error = 3 : No processes found

Remarks

Supplementary to ProcessExists().

Related

ProcessExists

Example

#include <Process.au3>

Run("notepad.exe")
WinWaitActive("Untitled - Notepad", "")
$pid = WinGetProcess("Untitled - Notepad", "")
$name = _ProcessGetName($pid)

MsgBox(0, "Notepad - " & $pid, $name)


Function _ProcessGetPriority

Function Reference

_ProcessGetPriority

Get the priority of an open process

#include <Process.au3>
_ProcessGetPriority ($i_PID)

Parameters

$i_PID Process ID (Int) of process to be examined.

Return Value

Success: | Returns integer corressponding to the processes's priority:
 | 0 - Idle/Low
 | 1 - Below Normal (Not supported on Windows 95/98/ME)
 | 2 - Normal
 | 3 - Above Normal (Not supported on Windows 95/98/ME)
 | 4 - High
 | 5 - Realtime
Failure: | Returns -1 and sets @Error to 1

Remarks

None.

Related

ProcessSetPriority

Example

#include<process.au3>

Dim $i_Priority_Level, $i_Notepad_PID, $i_ArrayItem
Dim $a_RunLevels[3] = [0, 2, 4] ;low, normal, high priorities
;Get Priority Level of this instance of AutoIt Scripting Engine
$i_Priority_Level = _ProcessGetPriority (@AutoItPID)
MsgBox(0, "AutoIt Script", "Should be 2: " & $i_Priority_Level)
$i_Notepad_PID = Run(@ComSpec & ' /k notepad.exe', '', @SW_HIDE)
For $i_ArrayItem = 0 To 3
ProcessSetPriority($i_Notepad_PID, $a_RunLevels[$i_ArrayItem])
$i_Priority_Level = _ProcessGetPriority ($i_Notepad_PID)
MsgBox(0, "Notepad Priority", "Should be " & $a_RunLevels[$i_ArrayItem] & ": " & $i_Priority_Level)
Next
ProcessClose('notepad.exe')


Function _RunDOS

Function Reference

_RunDOS

Executes a DOS command in a hidden command window.

#include <Process.au3>
_RunDOS( $sCommand )

Parameters

$sCommand Command to execute

Return Value

Success: | Returns the exit code of the command
Failure: | Depends on RunErrorsFatal setting

Remarks

None.

Related

None.

Example

#include <Process.au3>
$rc = _RunDos("start Http://www.autoitscript.com")


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: String Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_HexToString | Convert a hex string to a string.
_StringEncrypt | An RC4 based string encryption function.
_StringInsert | Inserts a string within another string.
_StringProper | Changes a string to proper case, same a =Proper function in Excel
_StringRepeat | Repeats a string a specified number of times.
_StringReverse | Reverses the contents of the specified string.
_StringToHex | Convert a string to a hex string.


Function _HexToString

Function Reference

_HexToString

Convert a hex string to a string.

#include <String.au3>
_HexToString( strHex )

Parameters

strHex
an hexadecimal string

Return Value

Success: | Returns a string.
Failure: | Returns -1 and sets @error to 1.

Remarks

None.

Related

_StringToHex

Example

#include <string.au3>
$String = "I like AutoIt3"
$Hex = _StringToHex($String)
MsgBox(0, "Hex", "Original String: " & $String & @LF & " Hex: " & $Hex)

$Hex = "49206C696B65204175746F497433"
$String = _HexToString($Hex)
MsgBox(0, "Hex", "Original Hex: " & $Hex & @LF & " String: " & $String)


Function _StringEncrypt

Function Reference

_StringEncrypt

An RC4 based string encryption function.

#include <String.au3>
_StringEncrypt ( $i_Encrypt, $s_EncryptText, $s_EncryptPassword [, $i_EncryptLevel ] )

Parameters

$i_Encrypt | 1 to encrypt, 0 to decrypt.
$s_EncryptText | Text to encrypt/decrypt.
$s_EncryptPassword | Password to encrypt/decrypt with.
$i_EncryptLevel | Optional: Level to encrypt/decrypt. Default = 1

Return Value

Success: | The Encrypted/Decrypted string.
Failure: | Blank string and @error = 1

Remarks

WARNING: This function has an extreme timespan if the encryption level or encrypted string are too large!

Related

None.

Example

#include <guiconstants.au3>
#include <string.au3>
; GUI and String stuff
$WinMain = GuiCreate('Encryption tool', 400, 400)
; Creates window
$EditText = GuiCtrlCreateEdit('',5,5,380,350)
; Creates main edit
$InputPass = GuiCtrlCreateInput('',5,360,100,20, 0x21)
; Creates the password box with blured/centered input
$InputLevel = GuiCtrlCreateInput(1, 110, 360, 50, 20, 0x2001)
$UpDownLevel = GUICtrlSetLimit(GuiCtrlCreateUpDown($inputlevel),10,1)
; These two make the level input with the Up|Down ability
$EncryptButton = GuiCtrlCreateButton('Encrypt', 170, 360, 105, 35)
; Encryption button
$DecryptButton = GuiCtrlCreateButton('Decrypt', 285, 360, 105, 35)
; Decryption button
GUICtrlCreateLabel('Password', 5, 385)
GuiCtrlCreateLabel('Level',110,385)
; Simple text labels so you know what is what
GuiSetState()
; Shows window

Do
$Msg = GuiGetMsg()
If $msg = $EncryptButton Then
GuiSetState(@SW_DISABLE,$WinMain) ; Stops you from changing anything
$string = GuiCtrlRead($EditText) ; Saves the editbox for later
GUICtrlSetData($EditText,'Please wait while the text is Encrypted/Decrypted.') ; Friendly message
GuiCtrlSetData($EditText,_StringEncrypt(1,$string,GuiCtrlRead($InputPass),GuiCtrlRead($InputLevel)))
; Calls the encryption. Sets the data of editbox with the encrypted string
; The encryption starts with 1/0 to tell it to encrypt/decrypt
; The encryption then has the string that we saved for later from edit box
; It then reads the password box & Reads the level box
GuiSetState(@SW_ENABLE,$WinMain) ; This turns the window back on
EndIf
If $msg = $DecryptButton Then
GuiSetState(@SW_DISABLE,$WinMain) ; Stops you from changing anything
$string = GuiCtrlRead($EditText) ; Saves the editbox for later
GUICtrlSetData($EditText,'Please wait while the text is Encrypted/Decrypted.') ; Friendly message
GuiCtrlSetData($EditText,_StringEncrypt(0,$string,GuiCtrlRead($InputPass),GuiCtrlRead($InputLevel)))
; Calls the encryption. Sets the data of editbox with the encrypted string
; The encryption starts with 1/0 to tell it to encrypt/decrypt
; The encryption then has the string that we saved for later from edit box
; It then reads the password box & Reads the level box
GuiSetState(@SW_ENABLE,$WinMain) ; This turns the window back on
EndIf
Until $msg = $GUI_EVENT_CLOSE ; Continue loop untill window is closed


Function _StringInsert

Function Reference

_StringInsert

Inserts a string within another string.

_StringInsert($s_String, $s_InsertString, $i_Position)

Parameters

$s_String | Original string
$s_InsertString | String to be inserted
$i_Position | Position to insert string (negatives values count from right hand side)

Return Value

Success: | Returns new modified string
Failure: | Returns original string and sets the @error to the following values:
 | @error = 1 : Source string empty
 | @error = 2 : Insert string empty
 | @error = 3 : Invalid position

Remarks

Use negative position values to insert string from the right hand side.

Related

Example

#include<string.au3>
; Inserts three "moving" underscores and prints them to the console
For $i_loop = -20 To 20
ConsoleWrite($i_loop & @TAB & _StringInsert ("Supercalifragilistic", "___", $i_loop) & @CR)
Next


Function _StringProper

Function Reference

_StringProper

Changes a string to proper case, same a =Proper function in Excel

#Include <String.au3>
_StringProper ( $sString )

Parameters

$sString Input string

Return Value

Success: | Returns proper string.
Failure: | Returns "".
@Error: | NA

Remarks

This function will capitalize every character following a None Apha character.

Related

None.

Example

#include <String.au3>
;Will return : Somebody Lastnames
Msgbox(0,'',_StringProper("somebody lastnames"))
;Will return : Some.Body Last(Name)
Msgbox(0,'',_StringProper("SOME.BODY LAST(NAME)"))
Exit


Function _StringRepeat

Function Reference

_StringRepeat

Repeats a string a specified number of times.

#Include <String.au3>
_StringRepeat( $sString, $iRepeatCount )

Parameters

$sString | String to repeat
$iRepeatCount | Number of times to repeat the string

Return Value

Success: | Returns string with specified number of repeats
Failure: | Returns an empty string and sets @error = 1
@Error: | 0 = No error.
 | 1 = One of the parameters is invalid

Remarks

None.

Related

None.

Example

#include <String.au3>

Msgbox(0,'',_StringRepeat("+-",40))
Exit


Function _StringReverse

Function Reference

_StringReverse

Reverses the contents of the specified string.

#Include <String.au3>
_StringReverse( $sString )

Parameters

$sString String to reverse

Return Value

Success: | Returns reversed string
Failure: | Returns an empty string and sets @error = 1
@Error: | 0 = No error.
 | 1 = One of the parameters is invalid

Remarks

None.

Related

None.

Example

#include <String.au3>
Msgbox(0,'',_StringReverse("esreveR"))
Exit


Function _StringToHex

Function Reference

_StringToHex

Convert a string to a hex string.

#include <String.au3>
_StringToHex("string")

Parameters

string
string to be converted.

Return Value

Success: | Returns an hex string.
Failure: | Returns -1 and sets @error to 1.

Remarks

None.

Related

_HexToString

Example

#include <string.au3>
$String = "I like AutoIt3"
$Hex = _StringToHex($String)
MsgBox(0, "Hex", "Original String: " & $String & @LF & " Hex: " & $Hex)

$Hex = "49206C696B65204175746F497433"
$String = _HexToString($Hex)
MsgBox(0, "Hex", "Original Hex: " & $Hex & @LF & " String: " & $String)


User Defined Functions

User Defined Function Reference

Below is a list of the user defined functions for catagory: Visa Management.
Click on a user defined function name for a detailed description.

User Defined Function | Description
_viClose | Closes a VISA connection to an Instrument/Device
_viExecCommand | Send a Command/Query to an Instrument/Device through the VISA interface (GPIB / TCP)
_viFindGpib | Send a Command/Query to an Instrument/Device through the VISA interface (GPIB / TCP)
_viGpibBusReset | GPIB BUS "reset": Use this function when the GPIB BUS gets stuck for some reason. You might be lucky and resolve the problem by calling this function
_viGTL | Go To Local mode: Instruments that accept this command will exit the "Remote Control mode" and go to "Local mode". If the instrument is already in "Local mode" this is simply ignored. Normally, if an instrument does not support this command it will simply stay in the "Remote Control mode"
_viOpen | Opens a VISA connection to an Instrument/Device
_viSetAttribute | Set any VISA attribute This function, which is called by _viSetTimeout, can ALSO be used to set the other VISA specific attributes. Read the VISA documentation for more information and a list of VISA attributes and their corresponding values.
_viSetTimeout | Sets the VISA timeout in MILISECONDS


Function _viClose

Function Reference

_viClose

Closes a VISA connection to an Instrument/Device

#include <Visa.au3>
_viClose($h_session)

Parameters

$h_session A VISA session handle (as returned by _viOpen)

Return Value

Success: | Returns 0.
Failure: | Returns -1 if the VISA DLL could not be open or a NON ZERO value representing the VISA error code (see the VISA programmer's guide).
This function always sets @error to 1 in case of error.

Remarks

As for all the VISA functions the VISA libraries must be installed (you can check whether visa32.dll is in {WINDOWS}\system32) and a GPIB card (such as a National Instruments NI PCI-GPIB card or an Agilent 82350B PCI High-Performance GPIB card) must be installed

Related

_viClose, _viExecCommand

Example

;- This assumes that you have instrument set to GPIB address 1
; It shows how to use the _viExecCommand function in stand alone mode and combined
; with _viOpen and _viClose.
; It also shows the _viGTL function

#include <Visa.au3>

Dim $h_session = 0

; Query the ID of the instrument in GPIB address 3
MsgBox(0,"Step 1","Open the instrument connection with _viOpen")
Dim $h_instr = _viOpen("GPIB::3::0")
MsgBox(0,"Instrument Handle obtained", "$h_instr = " & $h_instr) ; Show the Session Handle
; Query the instrument

MsgBox(0,"Step 2","Query the instrument using the VISA instrument handle")
$s_answer = _viExecCommand($h_instr,"*IDN?") ; $h_instr is NOT A STRING now!
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer
; Query again. There is no need to OPEN the link again

MsgBox(0,"Step 3","Query again. There is no need to OPEN the link again")
$s_answer = _viExecCommand($h_instr,"*IDN?")
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 4","Close the instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection


Function _viExecCommand

Function Reference

_viExecCommand

Send a Command/Query to an Instrument/Device through the VISA interface (GPIB / TCP)

#include <Visa.au3>
_viExecCommand($h_session, $s_command, $i_timeout_ms = -1)

Parameters

$h_session A VISA descriptor (STRING) OR a VISA session handle (INTEGER)
This it can be a string or an integer (a handle):
* STRING -&gr; A VISA DESCRIPTOR is a string which specifies the resource with
which to establish a communication session.
An example descriptor is "GPIB::20::0".
This function supports all valid VISA descriptors, including GPIB, TCP, VXI
and Serial Interface instruments (ASRL).
A detailed explanation of VISA descriptors is shown in the Remarks section
of this function.
As a SHORTCUT you can also use a STRING containing the address number
(e.g. "20") of a GPIB instrument instead of typing the full descriptor
(in that case, "GPIB::20::0")
* INTEGER -&gr; A VISA session handle is an integer value returned by _viOpen.
It is recommended that instead you use _viOpen and VISA session handles
instead of descriptors if you plan to communicate repeteadly with an
Instrument or Device, as otherwise each time that you contact the instrument
you would incur the overhead of opening and closing the communication link.
Once you are done using the instrument you must remember to close the link
with _viClose.
$s_command Command/Query to execute (e.g. "*IDN?" or "SOURCE:POWER -20 dBM")
A query MUST contain a QUESTION MARK (?)
When the command is a QUERY the function will automatically wait for the
instrument's answer (or until the operation times out)
$i_timeout_ms Optional: The operation timeout in MILISECONDS.
This is mostly important for QUERIES only.
This is an OPTIONAL PARAMETER.
If it is not specified the last set timeout will be used. If it was never set
before the default timeout (which depends on the VISA implementation) will be used.
Timeouts can also be set separatelly with the _viSetTimeout function.
Depending on the bus type (GPIB, TCP, etc) the timeout might not be set to the
exact value that you request. Instead the closest valid timeout bigger than
the one that you requested will be used.

Return Value

The return value depends on whether the command is a QUERY
or not and in whether the operation was successful or not.
* Command, NON QUERY:
Success: | Returns ZERO
Failure: | Returns -1 if the VISA DLL could not be open
 | or a NON ZERO value representing the VISA
 | error code (see the VISA programmer's guide)
* QUERY:
Success: | Returns the answer of the instrument to the QUERY
Failure: | Returns -1 if the VISA DLL could not be open
 | Returns -3 if the VISA DLL returned an unexpected number of results
 | or returns a NON ZERO value representing the VISA
 | error code (see the VISA programmer's guide)
This function always sets @error to 1 in case of error.

Remarks

* The VISA queries only return the 1st line of the device answer
This is not a problem in most cases, as most devices will always
answer with a single line.

* The following is a description of the MOST COMMON VISA DESCRIPTORS
Note that there are some more types. For more info please
refer to a VISA programmer's guide (available at www.ni.com)
Optional segments are shown in square brackets ([]).
Required segments that must be filled in are denoted by angle
brackets (<&gr;).

Interface Syntax
------------------------------------------------------------
GPIB INSTR GPIB[board]::primary address
[::secondary address] [::INSTR]
GPIB INTFC GPIB[board]::INTFC
TCPIP SOCKET TCPIP[board]::host address::port::SOCKET
Serial INSTR ASRL[board][::INSTR]
PXI INSTR PXI[board]::device[::function][::INSTR]
VXI INSTR VXI[board]::VXI logical address[::INSTR]
GPIB-VXI INSTR GPIB-VXI[board]::VXI logical address[::INSTR]
TCPIP INSTR TCPIP[board]::host address[::LAN device name]
[::INSTR]

The GPIB keyword is used for GPIB instruments.
The TCPIP keyword is used for TCP/IP communication.
The ASRL keyword is used for serial instruments.
The PXI keyword is used for PXI instruments.
The VXI keyword is used for VXI instruments via either embedded
or MXIbus controllers.
The GPIB-VXI keyword is used for VXI instruments via a GPIB-VXI
controller.

The default values for optional parameters are shown below.

Optional Segment Default Value
---------------------------------------
board 0
secondary address none
LAN device name inst0

Example Resource Strings:
--------------------------------------------------------------
GPIB::1::0::INSTR A GPIB device at primary address 1 and
secondary address 0 in GPIB interface 0.

GPIB2::INTFC Interface or raw resource for GPIB
interface 2.

TCPIP0::1.2.3.4::999::SOCKET Raw TCP/IP access to port 999
at the specified IP address.

ASRL1::INSTR A serial device attached to interface
ASRL1. VXI::MEMACC Board-level register
access to the VXI interface.

PXI::15::INSTR PXI device number 15 on bus 0.

VXI0::1::INSTR A VXI device at logical address 1 in VXI
interface VXI0.

GPIB-VXI::9::INSTR A VXI device at logical address 9 in a
GPIB-VXI controlled system.

Related

_viFindGpib, _viOpen, _viClose, _viSetTimeout, _viGTL, _viGpibBusReset

Example

;- This assumes that you have instrument set to GPIB address 3
; If you have an instrument in a different address change "GPIB::3::0" to the
; corresponding descriptor. Do the same for the call to _viOpen
; It shows how to use the _viExecCommand function in stand alone mode and combined
; with _viOpen and _viClose.
; It also shows the _viGTL function

#include <Visa.au3>

Dim $h_session = 0

; Query the ID of the instrument in GPIB address 3
MsgBox(0,"Step 1","Simple GPIB query using a VISA Descriptor")
Dim $s_answer = _viExecCommand("GPIB::3::0","*IDN?",10000) ; 10 secs timeout
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 2","Go to LOCAL using VISA Descriptor")
_viGTL("GPIB::1::0") ; Go to local (exit remote control mode)

MsgBox(0,"Step 3","Simple GPIB query using a VISA address shortcut")
$s_answer = _viExecCommand("1","*IDN?") ; The address MUST BE A STRING
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer
MsgBox(0,"Info","Now let's use _viOpen and _viClose")

MsgBox(0,"Step 4","Open the instrument connection with _viOpen")
Dim $h_instr = _viOpen(3)
MsgBox(0,"Instrument Handle obtained", "$h_instr = " & $h_instr) ; Show the Session Handle
; Query the instrument

MsgBox(0,"Step 5","Query the instrument using the VISA instrument handle")
$s_answer = _viExecCommand($h_instr,"*IDN?") ; $h_instr is NOT A STRING now!
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer
; Query again. There is no need to OPEN the link again

MsgBox(0,"Step 6","Query again. There is no need to OPEN the link again")
$s_answer = _viExecCommand($h_instr,"*IDN?")
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 7","Go to LOCAL using VISA instrument handle")
_viGTL($h_instr); Go to local (this is optional)

MsgBox(0,"Step 8","Close the Instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection


Function _viFindGpib

Function Reference

_viFindGpib

Send a Command/Query to an Instrument/Device through the VISA interface (GPIB / TCP)

#include <Visa.au3>
_viFindGpib(ByRef $a_descriptor_list, ByRef $a_idn_list, $f_show_search_results = 0)

Parameters

$a_descriptor_list (ByRef) | RETURNS an array of the VISA resource descriptors of the instruments that were found in the GPIB bus (see the Remarks of the _viExecCommand for more info)
$a_idn_list (ByRef) | RETURNS an array of the IDNs (i.e names) of the instruments that were found in the GPIB bus
$f_show_search_results | Optional: If 1 a message box showing the results of the search will be shown. The default is 0, which means that the results are not shown

Return Value

Success: | The number of instruments found (0 or more)
Failure: | Returns a NEGATIVE value and SETS @error to 1

Remarks

As for all the VISA functions the VISA libraries must be installed (you can check whether visa32.dll is in {WINDOWS}\system32) and a GPIB card (such as a National Instruments NI PCI-GPIB card or an Agilent 82350B PCI High-Performance GPIB card) must be installed

* For a detailed description of the most common VISA DESCRIPTORS look at the Remarks of the help on the _viExecCommand function

Related

_viExecCommand, _viOpen, _viClose, _viGTL

Example

; This example performs a search on the GPIB bus and shows the results in a MsgBox

#include <Visa.au3>

Dim $a_descriptor_list[1], $a_idn_list[1]
_viFindGpib($a_descriptor_list, $a_idn_list, 1)


Function _viGpibBusReset

Function Reference

_viGpibBusReset

GPIB BUS "reset": Use this function when the GPIB BUS gets stuck for some reason. You might be lucky and resolve the problem by calling this function

#include <Visa.au3>
_viGpibBusReset()

Parameters

None

Return Value

Success: | Returns 0
Failure: | Returns -1 if the VISA DLL could not be open or a NON ZERO value representing the VISA error code (see the VISA programmer's guide)
This function always sets @error to 1 in case of error

Remarks

As for all the VISA functions the VISA libraries must be installed (you can check whether visa32.dll is in {WINDOWS}\system32) and a GPIB card (such as a National Instruments NI PCI-GPIB card or an Agilent 82350B PCI High-Performance GPIB card) must be installed

Related

_viGTL, _viExecCommand, _viFindGpib, _viOpen, _viClose

Example

; This example tries to "reset" the GPIB bus after a BUS "lock". This is rare,
; but it might happen if one of the instruments connected to the BUS has crashed

#include <Visa.au3>

_viGpibBusReset()


Function _viGTL

Function Reference

_viGTL

Go To Local mode: Instruments that accept this command will exit the "Remote Control mode" and go to "Local mode". If the instrument is already in "Local mode" this is simply ignored. Normally, if an instrument does not support this command it will simply stay in the "Remote Control mode"

#include <Visa.au3>
_viGTL($h_session)

Parameters

$h_session A VISA descriptor (STRING) OR a VISA session handle (INTEGER).
See the Remarks of the _viExecCommand for more info.

Return Value

Success: | Returns 0
Failure: | Returns -1 if the VISA DLL could not be open or a NON ZERO value representing the VISA error code (see the VISA programmer's guide).
This function always sets @error to 1 in case of error

Remarks

As for all the VISA functions the VISA libraries must be installed (you can check whether visa32.dll is in {WINDOWS}\system32) and a GPIB card (such as a National Instruments NI PCI-GPIB card or an Agilent 82350B PCI High-Performance GPIB card) must be installed

* For a detailed description of the most common VISA DESCRIPTORS look at the Remarks of the help on the _viExecCommand function

Related

_viExecCommand, _viGpibBusReset, _viFindGpib, _viOpen, _viClose

Example

;- This assumes that you have instrument set to GPIB address 3
; If you have an instrument in a different address change "GPIB::3::0" to the
; corresponding descriptor. Do the same for the call to _viOpen
; It shows how to use the _viGTL function with a VISA descriptor and with a
; VISA device handler. We use _viExecCommand first to force the instrument to go
; into "Remote mode"

#include <Visa.au3>

Dim $h_session = 0

; Query the ID of the instrument in GPIB address 3
MsgBox(0,"Step 1","Simple GPIB query using a VISA Descriptor")
Dim $s_answer = _viExecCommand("GPIB::3::0","*IDN?",10)
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 2","Go to LOCAL using VISA Descriptor")
_viGTL("GPIB::1::0") ; Go to local (exit remote control mode)

MsgBox(0,"Step 4","Open the instrument connection with _viOpen")
Dim $h_instr = _viOpen(3)
MsgBox(0,"Instrument Handle obtained", "$h_instr = " & $h_instr) ; Show the Session Handle
; Query the instrument

MsgBox(0,"Step 5","Query the instrument using the VISA instrument handle")
$s_answer = _viExecCommand($h_instr,"*IDN?") ; $h_instr is NOT A STRING now!
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer
; Query again. There is no need to OPEN the link again

MsgBox(0,"Step 6","Query again. There is no need to OPEN the link again")
$s_answer = _viExecCommand($h_instr,"*IDN?")
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 7","Go to LOCAL using VISA instrument handle")
_viGTL($h_instr); Go to local (this is optional)

MsgBox(0,"Step 8","Close the Instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection


Function _viOpen

Function Reference

_viOpen

Opens a VISA connection to an Instrument/Device

#include <Visa.au3>
_viOpen($s_visa_address, $s_visa_secondary_address = 0)

Parameters

$s_visa_address | A VISA resource descriptor STRING (see the NOTES of _viExecCommand above for more info) As as shortcut you can also directly pass a GPIB address as an integer
$s_visa_secondary_address | Optional: The "secondary GPIB address". Only used if the primary address is passed as an integer. Only some GPIB instruments have secondary addresses. In those cases this optional parameter can be used to specify it. This parameter is ZERO by default, which means NO SECONDARY ADDRESS

Return Value

Success: | Returns a (POSITIVE) VISA Instrument Handle
Failure: | Returns -1 and SETS @error to 1

Remarks

As for all the VISA functions the VISA libraries must be installed (you can check whether visa32.dll is in {WINDOWS}\system32) and a GPIB card (such as a National Instruments NI PCI-GPIB card or an Agilent 82350B PCI High-Performance GPIB card) must be installed

* For a detailed description of the most common VISA DESCRIPTORS look at the Remarks of the help on the _viExecCommand function

Related

_viClose, _viExecCommand

Example

;- This assumes that you have instrument set to GPIB address 1
; It shows how to use the _viExecCommand function in stand alone mode and combined
; with _viOpen and _viClose.
; It also shows the _viGTL function
#include <Visa.au3>
Dim $h_session = 0

; Query the ID of the instrument in GPIB address 3
MsgBox(0,"Step 1","Open the instrument connection with _viOpen")
Dim $h_instr = _viOpen("GPIB::3::0")
MsgBox(0,"Instrument Handle obtained", "$h_instr = " & $h_instr) ; Show the Session Handle
; Query the instrument

MsgBox(0,"Step 2","Query the instrument using the VISA instrument handle")
$s_answer = _viExecCommand($h_instr,"*IDN?") ; $h_instr is NOT A STRING now!
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer
; Query again. There is no need to OPEN the link again

MsgBox(0,"Step 3","Query again. There is no need to OPEN the link again")
$s_answer = _viExecCommand($h_instr,"*IDN?")
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 4","Close the instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection

MsgBox(0,"Step 5","Open the Instrument connection using only the address number")
Dim $h_instr = _viOpen(3)
MsgBox(0,"Instrument Handle obtained", "$h_instr = " & $h_instr) ; Show the Session Handle
; Query the instrument

MsgBox(0,"Step 6","Query the instrument using the VISA instrument handle")
$s_answer = _viExecCommand($h_instr,"*IDN?") ; $h_instr is NOT A STRING now!
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer
; Query again. There is no need to OPEN the link again

MsgBox(0,"Step 7","Query again. There is no need to OPEN the link again")
$s_answer = _viExecCommand($h_instr,"*IDN?")
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 8","Close the instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection


Function _viSetAttribute

Function Reference

_viSetAttribute

Set any VISA attribute This function, which is called by _viSetTimeout, can ALSO be used to set the other VISA specific attributes. Read the VISA documentation for more information and a list of VISA attributes and their corresponding values.

#include <Visa.au3>
_viSetAttribute($h_session, $i_attribute, $i_value)

Parameters

$h_session | A VISA descriptor (STRING) OR a VISA session handle (INTEGER). See the Remarks of the _viExecCommand for more info.
$i_attribute | The index of the attribute that must be changed. Attributes are defined in the VISA library. This AutoIt library only defines a CONSTANT for the TIMEOUT attribute ($VI_ATTR_TMO_VALUE) and for the Serial Interface attributes and values (see the remarks) but you can pass any other valid index (as an integer) if you want to.
$i_value | The value of the attribute. It must be an integer and the possible values depend on the attribute type and are defined in the VISA documentation.

Return Value

Success: | Returns 0
Failure: | Returns -1 if the VISA DLL could not be open or a NON ZERO value representing the VISA error code (see the VISA programmer's guide).
This function always sets @error to 1 in case of error.

Remarks

This is a list of the currently pre-defined attributes and values. Remember that you can use any other valid attribute/value by passing the corresponding integer index (as defined in the VISA programmer's guide) to this function.

* Attribute: $VI_ATTR_TMO_VALUE -> Set Timeout
* Values:
A timeout in MILLISECONDS or
$VI_TMO_IMMEDIATE (or 0) for "Return immediatly"
VI_TMO_INFINITE (or "INF") for "No timeout"

* Attribute: $VI_ATTR_ASRL_BAUD
* Values:
Any valid baudrate (9600, 115200, etc)

* Attribute: $VI_ATTR_ASRL_DATA_BITS
* Values:
From 5 to 8

* Attribute: $VI_ATTR_ASRL_PARITY
* Values:
$VI_ASRL_PAR_NONE
$VI_ASRL_PAR_ODD
$VI_ASRL_PAR_EVEN
$VI_ASRL_PAR_MARK
$VI_ASRL_PAR_SPACE

* Attribute: $VI_ATTR_ASRL_STOP_BITS
* Values:
$VI_ASRL_STOP_ONE
$VI_ASRL_STOP_ONE5
$VI_ASRL_STOP_TWO

* Attribute: $VI_ATTR_ASRL_FLOW_CNTRL
* Values:
$VI_ASRL_FLOW_NONE
$VI_ASRL_FLOW_XON_XOFF
$VI_ASRL_FLOW_RTS_CTS
$VI_ASRL_FLOW_DTR_DSR

As for all the VISA functions the VISA libraries must be installed (you can check whether visa32.dll is in {WINDOWS}\system32).
You onlly need a GPIB card (such as a National Instruments NI PCI-GPIB card or an Agilent 82350B PCI High-Performance GPIB card) if you use the GPIB related functions.

* For a detailed description of the most common VISA DESCRIPTORS look at the Remarks of the help on the _viExecCommand function

Related

_viSetTimeout, _viExecCommand, _viOpen, _viClose

Example

;- This assumes that you have instrument set to GPIB address 3.
; If you have an instrument in a different address change "GPIB::3::0" to the
; corresponding descriptor. Do the same for the call to _viOpen
; It shows how to use the _viSetAttribute. In this example we use _viSetAttribute
; instead of _viSetTimeout to set the GPIB timeout of a _viExecCommand operation.

#include <Visa.au3>

Dim $h_session = 0

; Query the ID of the instrument in GPIB address 3
MsgBox(0,"Step 1","Simple GPIB query with explicit TIMEOUT set")
Dim $s_answer = _viExecCommand("GPIB::3::0","*IDN?",10000) ; 10 secs timeout
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

; This is the same as using the _viSetAttribute function first:
MsgBox(0,"Step 2","_vOpen + timeout using _viSetAttribute + GPIB query")
Dim $h_instr = _viOpen(3)
; NOTE - This is the same as: _viSetTimeout($h_instr, 10000)
_viSetAttribute($h_instr, $VI_ATTR_TMO_VALUE, 10000) ; 10000 ms = 10 secs

$s_answer = _viExecCommand($h_instr,"*IDN?") ; No need to set the timeout now
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 3","Close the Instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection


Function _viSetTimeout

Function Reference

_viSetTimeout

Sets the VISA timeout in MILISECONDS

#include <Visa.au3>
_viSetTimeout($h_session, $i_timeout_ms)

Parameters

$h_session | A VISA descriptor (STRING) OR a VISA session handle (INTEGER). See the Remarks of the _viExecCommand for more info.
$i_timeout_ms | The timeout IN MILISECONDS for VISA operations (mainly for GPIB queries) If you set it to 0 the tiemouts are DISABLED. If you set it to "INF" the VISA operations will NEVER timeout. Be careful with this as it could easly hung your program ifv your instrument does not respond to one of your queries. Depending on the bus type (GPIB, TCP, etc) the timeout might not be set to the exact value that you request. Instead the closest valid timeout bigger than the one that you requested will be used.

Return Value

Success: | Returns 0
Failure: | Returns -1 if the VISA DLL could not be open or a NON ZERO value representing the VISA error code (see the VISA programmer's guide).
This function always sets @error to 1 in case of error.

Remarks

Most of the time it is not necessary to call this function, as _viExecCommand has a third OPTIONAL parameter $i_timeout_ms which can also be used to set the VISA timeout.

As for all the VISA functions the VISA libraries must be installed (you can check whether visa32.dll is in {WINDOWS}\system32) and a GPIB card (such as a National Instruments NI PCI-GPIB card or an Agilent 82350B PCI High-Performance GPIB card) must be installed

* For a detailed description of the most common VISA DESCRIPTORS look at the Remarks of the help on the _viExecCommand function

Related

_viSetAttribute, _viExecCommand, _viOpen, _viClose

Example

;- This assumes that you have instrument set to GPIB address 3.
; If you have an instrument in a different address change "GPIB::3::0" to the
; corresponding descriptor. Do the same for the call to _viOpen
; It shows how to use the _viExecCommand function with a timeout or how to
; call _viSetTimeout instead.

#include <Visa.au3>

Dim $h_session = 0

; Query the ID of the instrument in GPIB address 3
MsgBox(0,"Step 1","Simple GPIB query with explicit TIMEOUT set")
Dim $s_answer = _viExecCommand("GPIB::3::0","*IDN?",10000) ; 10 secs timeout
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

; This is the same as using the _viSetTimeout function first:
MsgBox(0,"Step 2","_vOpen + timeout using _viSetTimeout + GPIB query")
Dim $h_instr = _viOpen(3)
_viSetTimeout($h_instr, 10000) ; 10000 ms = 10 secs
$s_answer = _viExecCommand($h_instr,"*IDN?") ; No need to set the timeout now
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 3","Close the Instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection


1.66 (17 July 2006)
   - Changed _FilesListToArray(): Added @error 4 meaning no files found. (gafrost)
   - Gui Function general cleanup (gafrost)
   - Changed: Constants seperated out into seperate files. (Valik)
   - Changed: GUIConstants.au3 is now a stub including pretty much everything (Use GUIConstantsEx.au3 and the
     other *Constants.au3 files for more granularity). (Valik)
   - Updated several Helpfile pages for ie.au3. (Big_Daddy)
   - Updated several functions in visa.au3. (Angel)
      - Fixed : _viPrintf and _viExecCommand would not work with certain GPIB cards (such as USB-GPIB cards).
        Changed use of the VISA command "viWrite" method to be more generic (thanks John Herrington for the tip).
      - Added : Additional OPTIONAL parameter for _viPrintf and _viExecComand. Controls command send mode
        and terminator. Default value is "Use @LF terminator".
      - Updated : _viPrintf and _ViExecCommand append an @LF to every VISA command by default.
        This can be changed by means of a new optional parameter.
      - Updated : _viPrintf and _ViExecCommand do not "protect" for escape characters anymore by default.
        That causes problems with some GPIB cards. It is possible to go back to the original behaviour
        by setting the new optional parameter $s_mode to "str".

1.65 (6 July 2006)
   - Added IE.au3 with all its well known Functions. Big Thanks to DaleHohm and Big_Daddy. (DaleHohm,Big_Daddy)
   - Changed _InetSmtpMail(), change initial connection logic.  (Neil)
   - Fixed _TicksToTime() StringIsInt() problem. (JdeB)
   - Fixed Bug in _GUICtrlListViewGetItemText on return if a subitem is empty. (gafrost)

1.64 (27 June 2006)
   - Updated _GUICtrlListViewGetItemText: removed $v_ret variable to avoid au3check errors. (gafrost)
   - Updated _GUIListView: Some bugfixes and Helpfile correction. (gafrost)
   - Updated _GUIListView: Found a way I can live with the -1 being in the _GUICtrlListViewGetItemText
     and _GUICtrlListViewGetItemTextArray for using selected index in the function calls. (gafrost)

1.63 (19 June 2006)
   - Updated _DateTimeFormat() to use a default template when registry entries are missing
     Like in Win9x/WinME for SLongDate.
   - GuiListView updated .This update will possible break scripts. (gafrost)
      Replaced ControlListView calls (will no longer need window title/text in params).
      Functions updated to reflect new params.
      Examples updated for consistancy.
      Templates updated as needed.
   - _ArrayBinarySearch: (JdeB)
      removed check for more than 1 entry to allow the use of this UDF on arrays with one entry.

1.62 (2 June 2006)
   - Fixed _ClipPutFile() example include statement. (RazerM)
   - Doc Fixes:
     _GUICtrlListViewEnsureVisible. (gafrost)
     _FileReadToArray. (CyberSlug)
   _ Fixed _Now() which was returning "tt" at the end (JdeB)

1.61 (23 May 2006)
   - Fixed _GuiCtrlListViewSort() avoiding insert/removal of spaces. (gafrost)
   - Changed test in _DateIsValid() test from <1900 to <1000 to allow
     a startdate of 1600 used for UTC calculations. (JdeB)
   - Changed _GUICtrlListViewSort. (JPM)
   - Added _ClipPutFile() to misc.au3. (Piccaso)
   - Updated _GUICtrlListViewSetItemSelState, added an optional focus state parameter. (gafrost)

1.60 (28 April 2006)
   - Updated _GuiCtrlStatusBarResize example. (gafrost)
   - Added 2 variables to GuiStatusBar.au3. (gafrost)
   - Fixed typo in _ArraySort. (Knight)

1.59 (20 April 2006)
   - Updated _ProcessGetPriority to use 0x0400. (Valik)
   - Added _GUICtrlEditSetRECT to GuiEdit.au3. (gafrost)
   - Updated Email addresses in UDF's to avoid retrieval by search engines. (JPM)

1.58 (6 April 2006
   - updated _ProcessGetPriority() to accept either a name or PID argument. (Valik)
   - Fixed bug in _FileWriteLine() insert mode not inserting new line. (sasdad)

1.57 (19 March 2006
   - Updated : GUICtrlTreeView
     * Changed _GUICtrlTreeViewExpand (Parent GUI handle no longer needed) (Holger)
     * Renamed _GUICtrlTreeViewItemGetTree to _GUICtrlTreeViewGetTree !!! (Holger)
     * Added _GUICtrlTreeViewGetState (Holger)
     * Added _GUICtrlTreeViewGetText (Holger)
     * Added _GUICtrlTreeViewInsertItem (Holger)
     * Added _GUICtrlTreeViewSetIcon (Holger)
     * Added _GUICtrlTreeViewSetState (Holger)
     * Added _GUICtrlTreeViewSetText (Holger)

1.56 (15 March 2006)
   - Updated _GUICtrlListViewSort Helpfile example. (gafrost)
   - Updated _GUICtrlCombo examples updated to proper height. (gafrost)
   - Updated GUIComboau3. Added #include <GUIConstants.au3>. (andyswarbs)

1.55 (2 March 2006)
   - Updated INetSmtpMail(),allow the "EHLO" to be send. (JPM)
   - Added Attribute to _GUICtrlComboAddDir, _GUICtrlListAddDir. (gafrost)
   - Added _GUICtrlListViewSetColumnHeaderText() to GuiListView. (gafrost)

1.54 (23 February 2006)
   - Added _GuiCtrlEditFind to GUIEDIT.AU3: - Find/Replace text in an Edit control. (gafrost)
   - Added _FileWriteToLine to FILE.AU3: Writes text to a specific line in a file. (cdkid)

1.53 (16 February 2006)
   - Fixed _GuiCtrlListViewDeleteItem: Listview items can't be deleted after sorting. (gafrost)

1.52 (8 February 2006)
   - Fixed typo in _ArraySearch Helpfile. (theguy0000)
   - Fixed _ArraySort Local $t decleration. (gafrost)
   - Fixed _GUICtrlComboAutoComplete() move Variable definitions to the stat of the function. (gafrost)
   - Fixed _GuiCtrlStatusBarCreate : corrected variable declarations in the function. (gafrost)

1.51 (3 February 2006)
   - Changed _InetGetSource to return "" when error occurs.  (erebus)
   - Changed Dim to Local in GuiStatusBar.au3. (Jdeb)
   - Change _GuiCtrlStatusBarSetIcon that will allow removing the icon from normal status bar. (gafrost)
   - Added version at the top of each UDF file.

1.50 (20 January 2006)
   - Added _GUIStatusBar.au3 UDF's. (gafrost, rysiora, JdeB, tonedef, eltorro)
   - Added _GUICtrlComboGetList to GUICombo.au3 which retrieves all items in a combobox (Valik)
   - Fixed _INetSmtpMail() paramater variable name. (JPM)

1.49 (17 January 2006)
   - Fixed bug in _ArrayPush() when Direction 1 is specified. (AnnA)
   - Helpfile _ArraySearch example corrected. (Valuater)
   - Removed obsolete parameters from _GUICtrlTreeViewSelectItem(), Scripts need updating! (JdeB)
   - Fixed : _INetSmtpMail() (by JPM). (Thanks Wooltown, MikeOsdx)
   - Updated all UDFs to get rid of any Errors from Au3Check v 1.50 will All checks enabled.
   - Updated _ArrayDisplay() added Const to Byref of the first parameter. (Valik)
   - Fixed bug in _PathFull when using root of a drive. (Valik)

1.48 (7 January 2006)
   - Fixed : _PathFull() 2 bugs. (by Valik)
   - Fixed : _INetSmtpMail() @error 5 (by JPM). (Thanks Wooltown, MikeOsdx)
   - Fixed : _StringEncrypt error return. (Thanks JerryD)

1.47 (30 December 2005)
   - Fixed _DateTimeFormat() to return LongTime notation for $sType=0 as specified in the Helpfile. (JdeB)
   - Made Subject and Body optional in _InetSmtpMail().  (PartyPooper)

1.46 (21 December 2005)
   - Fixed doc for _FileReadToArray(). (LxP)
   - Fixed doc and Example for _ArraySearch. (Knight)
   - Fixed _ArraySearch return value in case not found to -1. (SolidSnake)
   - Added _InetSmtpMail to Inet.au3. (Walkabout)

1.45 (2 December 2005)
   - Fixed _PathSplit(). Changed Dim $array[5] to Local $array[5]. (LxP)
   - Updated _InetGetSource(), Remove stripping last character in return string. (w0uter)
   - Fixed return value in _GUICtrlTreeViewDeleteItem when item id passed in. (gafrost)
   - Updated GUI UDFs: Update Includes and Templates for use with external controls
     Meaning controlID for autoit control, control hWnd for external control
     Also replace all Dim statements with Local. (gafrost)

1.44 (25 November 2005)
   - Fixed _ReplaceStringInFile to avoid adding CRLF when missing at the EOF. (JdeB)
   - Added _ProcessGetName to Process.au3. (Erifash)

1.43 (18 November 2005)
   - Fixed _DateAdd() Typo's in helpfile. (Gene)
   - Updated _INetMail() with new logic to support environment variables. (JPM)
   - Updated _GUICtrlListViewDeleteItemsSelected() with Test for Array. (CatchFish)
   - Added a Constant to GUIList.au3 and changed all examples. (gafrost)

1.42 (2 November 2005)
   - Updated _ArrayToString documentation, changed parameter order. (Josbe)
   - Updated _FileList2Array: removed checking for "." and ".." from the return from FileFindNextFile(). (SolidSnake)
   - Added _SetDate and _SetTime to Date.au3. (/dev/null)
   - Added _StringInsert to String.au3. (Celeri)
   - Fixed bug in the _GUICtrlListViewDeleteItem. (gafrost)

1.41 (10 October 2005)
   - Fixed BUG in _ReplaceStringInFile() always replacing multiple occurences on a single line. (Wooltown/LxP)
   - Added _GUICtrlListSelectIndex to GuiList.au3 for single select listbox's. (gafrost)

1.40 (5 October 2005)
   - Fixed error in _ArrayToString example. (/dev/null)
   - Changed _WeekNumberISO() to return the proper ISO weeknr.
     Also removed startday parameter because ISO weeks always starts on Monday. (jdeb)
   - Added _DateToDayOfWeekISO which retruns the ISO day number. 0=Monday - 6= Sunday (jdeb)
   - Fixed bug in _GUICtrlListViewDeleteAllItems. (gafrost)

1.39 (27 September 2005)
   - Updated _InetGetSource. (w0uter)

1.38 (26 September 2005)
   - Fixed GUICtrlTreeViewDeleteItem() selection logic. (gafrost)
   - Fixed GUICtrlTreeViewSelectItem() but removed Helpfile info because function is obsolete. (gafrost)

1.37 (20 September 2005)
   - Added _FileWriteFromArray() to file.au3. (jdeb)
   - Updated _InetGetSource. (w0uter)
   - Updated _TempFile with optional parameters.  (hansh)
   - Fixed documentation for _FileListToArray. (mlazovjp/Dickb)
   - Some code optimization changes: GuiList, GuiTreeView, GuiEdit (gafrost)
   - Fixed logic issue with _GUICtrlListViewSetColumnOrder and _GUICtrlComboGetEditSel. (jdeb)
   - Fixed a few minor documentation issues.

1.36 (5 September 2005)
   - Updated _DateTimeFormat: Added option 5 which returns time in 24 hour HH:MM:SS format. (jdeb)
   - Updated _NowTime: Added optional parameter to select the return format. (jdeb)
   - Fixed Documentation _MouseTrap()  (JPM)
   - Fixed _GUICtrlTreeViewDeleteItem bug in delete of item after adding child items. (gafrost)
   - Updated _StringToHex() and _HexToString() error testing. (JPM)
   - Updated Doc return Value formating. (JPM)

1.35 (31 August 2005)
   - Fixed _IsPressed Example. (gafrost)

1.34 (30 August 2005)
   - Fixed _ArraySearch example to point to Array.au3.
   - Updated _IsPressed Added optional param to function for those that will use
     the function heavily they can pass a handle to the function for the dll.  (gafrost/w0uter)

1.33 (28 August 2005)
   - Updated _ProcessGetPriority script logic and fixed example.  (MSLx Fanboy)

1.32 (28 August 2005)
   - Updated _ProcessGetPriority script logic.  (MSLx Fanboy)
   - Added _IsPressed (Ezzetabi/Jon)
   - Updated Corrected return value for _MouseTrap if no params passed. (gafrost)
   - Added _GUICtrlComboAutoComplete (gafrost)
   - Restored correct example for _GUICtrlListViewGetItemText (jdeb)
   - Added _ArrayPush to Array.au3 (hgeras)
   - Added _ArraySearch to Array.au3 (SolidSnake)
   - Added _ReplaceStringInFile to File.au3 (\dev\null)

1.31 (13 August 2005)
   - Updated _PathMake and _PathSplit documentation.
   - Updated _MouseTrap  (gafrost)
   - Updated _GUICtrlEditScroll: Added $SB_SCROLLCARET - Scrolls the caret into view. (gafrost)
   - Added _ProcessGetPriority to Process.au3  (MSLx Fanboy)
   - Added _FilePrint to File.au3 (Erifash)

1.30 (11 August 2005)
   - Fixed _DayValueToDate() to return Day and Month in the proper format.
   - Fixed _DateTimeFormat() to return HH:MM in proper 24 hour notation for $sType=0.

1.29 (5 August 2005)
   - Added _GUICtrlListViewCopyItems to GUIListView.au3. (gafrost)
   - Fixed source/documentation _INetGetSource
   - Added _MouseTrap to Misc.au3. (gafrost)
   - Fixed _GetIP and _RunDOS doc. (gafrost)
   - Added _Singleton to Misc.au3.
   - Fixed _GUICtrlListViewSort if no items in listview. (gafrost)

1.28 (19 July 2005)
   - Fixed _INetGetSource.au3 example (W0uter)
   - Fixed _FileReadToArray(): added StringStripCR to avoid @CR characters in the Array values. (jdeb)
   - Fixed _GUICtrlListViewDeleteItemsSelected was not working correctly (gafrost)

1.27 (17 July 2005)
   - Added _Radian() and _Degree() to Math.au3 (Erifash)
   - Added _FileList2Array.au3 to File.au3 (Solid)
   - Added _INetGetSource.au3 to Inet.au3 (W0uter)
   - Fixed documentation for _ArraySort() (jdeb)

1.26 (15 July 2005)
   - Bug Fixed: _GUICtrlListViewGetNextItem.  (gafrost)

1.25 (14 July 2005)
   - Bug Fixed: _GUICtrlListViewDeleteAllItems and _GUICtrlListViewDeleteItem
     when _GUICtrlListViewInsertItem used to populate the ListView. (gafrost)

1.24 (13 July 2005)
   - Fixed _GUICtrlListViewGetNextItem.au3 example (gafrost)
   - Fixed _DateIsValid Documentation and Example.

1.23 (07 July 2005)
   - Updated _TimetoTicks: Made parameters optional defaulting to current time (slimshady)
   - Corrected Example for _GUICtrlTreeViewGetParentHandle (gafrost)
   - Added _GUICtrlTreeViewGetParentID to GuiTreeView (gafrost)

1.22 (05 July 2005)
   - Fixed variables already declared in examples for _GUICtrlTreeView??? (gafrost)
   - Added _GUICtrlTreeViewGetParentHandle  (gafrost)
   - Fixed variables already declared in string.au3 (jdeb)

1.21 (22 June 2005)
   - Fixed Dim for $h_Tree in _GUICtrlTreeViewItemGetTree. (gafrost)
   - Added variable passed in to _GUICtrlTreeViewItemGetTree
     and changed example to refelect this change for seperator char. (gafrost)

1.20 (20 June 2005)
   - Removed the following functions from GuiListView.au3:  (gafrost)
     _GUICtrlListViewSetBkColor
     _GUICtrlListViewSetTextBkColor
     _GUICtrlListViewSetTextColorFixed
   - Fixed _GUICtrlTreeViewDeleteItem() to deleted more than 2 levels deep. (gafrost)
   - Added GUICtrlTreeView.au3 UDF's (gafrost)

1.19 (10 June 2005)
   - Fixed some merge issues.

1.18 (9 June 2005)
   - Fixed descending sort issue in multi dimension arrays.
   - Fixed _GUICtrlListViewSort() top handle numeric values correctly. (gafrost)
   - Renamed _GUICtrlListViewGetColumnOrderArray to _GUICtrlListViewGetColumnOrder
      Also corrected documentation for _GUICtrlListViewGetColumnOrder.
      Returns a "|" delimited string instead of an array, now matches
      the _GUICtrlListViewSetColumnOrder in the data type.   (gafrost)

1.17 (6 June 2005)
    - Added _GUICtrlSliderGetPos functions in GUISlider.au3  (gafrost)
   - Fixed _ArraySort lockup Bug.

1.16 (2 June 2005)
   - Fixed _ArraySort to cope with Mixed values and string entries.
    - Added _GUISlider??? functions in GUISlider.au3  (gafrost)
    - Added _GUICtrlListViewInsertColumn, _GUICtrlListViewInsertItem, _GUICtrlListViewJustifyColumn
            _GUICtrlListViewSetColumnOrder, _GuiCtrlListViewSetItemCount, _GUICtrlListViewSort  (gafrost)

1.15 (24 May 2005)
   - Added 2 Functions to GuiListView.au3: _GUICtrlListViewSetItemSelState and
      _GUICtrlListViewSetItemText  (gafrost)
    - Fixed typo in _GUICtrlListViewGetExtendedListViewStyle helppage.
    - Fixed typo in _ViClose helppage.

1.14 (21 May 2005)
   - Fixed _GUICtrlListGetSelItems: returned array, was an array of string numbers
      now an array of numbers.  (gafrost)
   - Fixed _GUICtrlListViewGetSelectedIndices returned array, was an array of
      string numbers now an array of numbers. (gafrost)
   - Updated _GUICtrlListSetHorizontalExtent documentation. (gafrost)

1.13 (19 May 2005)
   - Added _GUICtrlListViewSetCheckState (gafrost)
   - Fixed _GUICtrlListViewGetCurSel: If more than 1 item in listview had same data was returning
      the index of the 1st instance, now correctly returns the index of item selected. (gafrost)
   - Added _GUICtrlMonthCal???? function located in GuiMonthCal.au3 (gafrost)

1.12 (12 May 2005)
   - Added _GUICtrlListViewGetCheckedState to GuiListView. (gafrost)
    - Update several Helpfile pages for the _GUI?? functions. (gafrost)
    - Update _ChooseColor.  (gafrost)
    - Updated _Now(),_NowDate(), _NowTime that it defauts to mm/dd/yyyy and hh:mm:ss when the
      pc's format isn't found in the registry (Win9X).

1.11 (8 May 2005)
   - Added GuiEdit.au3 which has a number of _GUIEdit??? functions for Edit controls. (gafrost)
    - Updated _ChooseColor, _ChooseFont and _GUI??? function due to DllStruct renaming. (gafrost)
    - Corrected wParam to variable name in _GUICtrlEditLineIndex.txt   (gafrost)
    - Fixed example and include for $CB_GETDROPPEDCONTROLRECT   (gafrost)
    - Type-0 in Example: _GUICtrlComboGetEditSel.au3    (gafrost)

1.10 (3 May 2005)
   - Fixed _GUICtrlComboSetHorizontalExtent.txt (gafrost)
   - Added _ChooseColor and _ChooseFont to Misc.au3 (gafrost)

1.09 (1 May 2005)
   - Added _GUITab Functions located in GuiTab.au3.  (gafrost)

1.08 (28 April 2005)
   - Fixed Example for _TickstoTime.au3.
   - Fixed Fixed _ArrayTrim(): $iTrimDirection test.

1.07 (27 April 2005)
   - Renamed All Functions:_GUICtrlComBoBox to _GUICtrlComBo and  _GUICtrlListBox to _GUICtrlList (gafrost)
   - Fixed _DateSplit(), Fix another issue that was introduced with previous fix.
   - Fixed _DateDaysInMonth.au3 example , @Year and @Mon were swapped.
   - Fixed _DateToDayOfWeek.au3, contained a syntax error.

1.06 (26 April 2005)
   - Added _GUICtrlListView functions in GuiListView.au3. (gafrost)
   - Updated _GUICtrlComBoBox & _GUICtrlListBox Documentation and Functions. (gafrost)
   - Fixed _DateSplit(), adding seconds when missing in the input.

1.05 (24 April 2005)
   - Added _GUICtrlComBoBox functions in GuiComboBox.au3. (gafrost)
   - Added _GUICtrlListBox functions in GuiListBox.au3. (gafrost)
    - Replaced _ArraySort() with faster version from LazyCoder/Tylo
   - Fixed _GetIp() to work with the new page layout.
   - Added _PathFull(), _PathMake() and _PathSplit() to File.au3.

1.04 (25 February 2005)
    - Fixed _ArrayMaxIndex() and _ArrayMinIndex() to set to proper initial value.
    - Fixed _ArraySort() issue with only 2 entries not being sorted.
    - Fixed documentation and example for _ArrayToString()
    - Fixed DateAdd() line 84: change == to =
    - Updated DateSplit() to convert date/time portion to number
    - Fixed VISA.au3 from Peppe.

1.03 (6 February 2005)
    *** Updated all documentation to follow the standard used in the helpfile.

    Array.au3:
    - Updated many Array Function with optional parameters like $iBase.(See helpfile for detail)
    - Updated a couple of Function to make use of the new Redim function.
    - Added: _ArraySort()
    - Added: _ArrayTrim()
    - Added: _ArrayCreate()

    Date.au3:
    - Added: _DateAdd, _DateDiff, _DateToDayValue, _DayValueToDate,
             _DateTimeFormat, _DayOfWeek, _DateIsValid,
             _Now(), Nowcalc(), Nowcalcdate(), _NowTime(),
             _NowDate(),_DaysInMonth()_DaysOfWeek()

    File.au3:
    - Removed: _DirRemoveContents , obsolete, replaced by FileDelete() internal command.
    - Removed: _FileAppend , obsolete, replaced by FileWriteLine("Filename",) internal command.
    - Updated: _FileCountLines with a faster version created by Tylo.
    - Added:   _TempFile()

    Inet.au3
    - Added: _INetExplorerCapable, _INetMail, _GetIp

    Math.au3:
    - Added:   _Ceil, _Floor, _MathCheckDiv, _MathCheckDiv

    Misc.au3:
    - Added:  _Iif()

    Process.au3:
    - Updated: _RunDos because the default quotes gave problems in Win9x.

    String.au3:
    - Added:  _StringProper(), _StringEncrypt(), _StringToHex(), HexToString()

   Visa.au3:
    - Added:  _viExecCommand,_viOpen, _viClose, _viFindGpib, _viSetTimeout,
              _viSetAttribute, _viGTL, _viGpibBusReset

1.02 (27 February 2004)
    - Added: _FileCountLines(), _DirRemoveContents()
    - Added: _DateDaysInMonth()
    - Added: _DateIsValidMonthNum(), _DateIsValidWeekdayNum(), _DateIsValidYear()
    - Added: _TimeIsValidHour(), _TimeIsValidMinute(), _TimeIsValidSecond()
    - Added: Usage syntax now included for documentation
    - Added: Documentation updates
    - Changed: _FileReadToArray() so it executes faster
    - Changed: (Internal) Enhanced the way the date/time functions operate
    - Changed: (Internal) File functions now use new file read/write syntax
    - Fixed: _RunDOS() to support executing DOS commands with spaces in the command

1.01 (5 February 2004)
    - Added: _ColorGetRed(), _ColorGetGreen(), _ColorGetBlue()
    - Added: _RunDOS()
    - Fixed: _TicksToTime() and _TimeToTicks()

1.00 (21 January 2004)
    - Initial release